Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.misc
Regnab
 
Posts: n/a
Default Using Vlookup with merged cells...

In column A I have group titles. In column B I have the individual
elements. So for example, the location in ColA is "Italy", and then the
company names located in Italy are in ColB. I have merged the rows in
Col A so that if I hide some but not all the rows corresponding to the
companies, the location ("Italy") appears for those still showing.

I would like to be able to use VLookup so I could type in a company
name and it would return the location. However, because it is a merged
cell, it returns "0". Anyone got any stunning ideas how I can do this
or will I need to unmerge in order to get a result??

Cheers

Reg

  #2   Report Post  
Posted to microsoft.public.excel.misc
Bryan Hessey
 
Posts: n/a
Default Using Vlookup with merged cells...


Not sure about your stup, are you typing INTO a merged cell, or looking
up a table of merged cells?
Valid is

=vlookup(mergedcell,table,2,false)

=vlookup(A1&B1,table,2,false)

does this help?

--

Regnab Wrote:
In column A I have group titles. In column B I have the individual
elements. So for example, the location in ColA is "Italy", and then
the
company names located in Italy are in ColB. I have merged the rows in
Col A so that if I hide some but not all the rows corresponding to the
companies, the location ("Italy") appears for those still showing.

I would like to be able to use VLookup so I could type in a company
name and it would return the location. However, because it is a merged
cell, it returns "0". Anyone got any stunning ideas how I can do this
or will I need to unmerge in order to get a result??

Cheers

Reg



--
Bryan Hessey
------------------------------------------------------------------------
Bryan Hessey's Profile: http://www.excelforum.com/member.php...o&userid=21059
View this thread: http://www.excelforum.com/showthread...hreadid=539128

  #3   Report Post  
Posted to microsoft.public.excel.misc
Regnab
 
Posts: n/a
Default Using Vlookup with merged cells...

I'm looking up the value that is in a merged cell. So just say there
are 3 companies in Italy - ComA, ComB and ComC in B1, B2 and B3. A1:A3
has been merged to display "Italy". I want to use VLookup so I can
enter ComA and it will display "Italy". Starting to think it may not be
possible with a merged cell...

Thanks for your help,

Reg

  #4   Report Post  
Posted to microsoft.public.excel.misc
Peo Sjoblom
 
Posts: n/a
Default Using Vlookup with merged cells...

No because merged A1:A3 = A1, there is no A2 or A3 with any value and all
references to them will always return a zero, however a vlookup looks up in
the leftmost column and returns its value from indexed columns to the right
so even if it would be possible to use merged cells it wouldn't work

You can use index(A2:A5,match(lookup_value,B2:B5,0)) but not with merged
cells in A

--

Regards,

Peo Sjoblom

Excel 95 - Excel 2007
Northwest Excel Solutions
www.nwexcelsolutions.com
"It is a good thing to follow the first law of holes;
if you are in one stop digging." Lord Healey


"Regnab" wrote in message
ups.com...
I'm looking up the value that is in a merged cell. So just say there
are 3 companies in Italy - ComA, ComB and ComC in B1, B2 and B3. A1:A3
has been merged to display "Italy". I want to use VLookup so I can
enter ComA and it will display "Italy". Starting to think it may not be
possible with a merged cell...

Thanks for your help,

Reg



  #5   Report Post  
Posted to microsoft.public.excel.misc
Bryan Hessey
 
Posts: n/a
Default Using Vlookup with merged cells...


I think it would only be possible with VB code, with a Worksheet change
event on column B (or the pressing of a button) to trigger a Filter
parameter being set for column A to the value in column A of the row
concerned.

Does that sound like what you need. ie, that a change to an item in
column B (ComA) causes a filter to be set on the value in column A
(Italy)?

--

Peo Sjoblom Wrote:
No because merged A1:A3 = A1, there is no A2 or A3 with any value and
all
references to them will always return a zero, however a vlookup looks
up in
the leftmost column and returns its value from indexed columns to the
right
so even if it would be possible to use merged cells it wouldn't work

You can use index(A2:A5,match(lookup_value,B2:B5,0)) but not with
merged
cells in A

--

Regards,

Peo Sjoblom

Excel 95 - Excel 2007
Northwest Excel Solutions
www.nwexcelsolutions.com
"It is a good thing to follow the first law of holes;
if you are in one stop digging." Lord Healey


"Regnab" wrote in message
ups.com...
I'm looking up the value that is in a merged cell. So just say there
are 3 companies in Italy - ComA, ComB and ComC in B1, B2 and B3.

A1:A3
has been merged to display "Italy". I want to use VLookup so I can
enter ComA and it will display "Italy". Starting to think it may not

be
possible with a merged cell...

Thanks for your help,

Reg



--
Bryan Hessey
------------------------------------------------------------------------
Bryan Hessey's Profile: http://www.excelforum.com/member.php...o&userid=21059
View this thread: http://www.excelforum.com/showthread...hreadid=539128



  #6   Report Post  
Posted to microsoft.public.excel.misc
Bryan Hessey
 
Posts: n/a
Default Using Vlookup with merged cells...


-note, test this on a spare copy of your workbook!-

to test that, - on the required sheet, - rightmouse the tab, and select
View Code, - then copy

Code:
--------------------

Option Explicit

Private Sub Worksheet_Change(ByVal Target As Range)
' stop events
Application.EnableEvents = False
On Error Resume Next
If Not Intersect(Target, Range("B:B")) Is Nothing Then
Dim iRow As Integer, iLastRow As Integer
iRow = Target.Row
iLastRow = Range("A65536").End(xlUp).Row
ActiveSheet.AutoFilterMode = False
Range("A1:A" & iLastRow).Select
Selection.AutoFilter
Selection.AutoFilter Field:=1, Criteria1:=Range("a" & iRow).Value
End If
Application.EnableEvents = True
On Error GoTo 0
End Sub

--------------------

into there, and then change an item in column B

This assumes that you have headers on row 1, "Italy" etc in column A,
and "ComA" etc in column B

HTH

--

Bryan Hessey Wrote:
I think it would only be possible with VB code, with a Worksheet change
event on column B (or the pressing of a button) to trigger a Filter
parameter being set for column A to the value in column A of the row
concerned.

Does that sound like what you need. ie, that a change to an item in
column B (ComA) causes a filter to be set on the value in column A
(Italy)?

--



--
Bryan Hessey
------------------------------------------------------------------------
Bryan Hessey's Profile: http://www.excelforum.com/member.php...o&userid=21059
View this thread: http://www.excelforum.com/showthread...hreadid=539128

Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
how can I find merged cells in a large xl-file tvanellen Excel Discussion (Misc queries) 5 May 8th 06 01:02 AM
how do i link merged cells to a merged cell in another worksheet. ibbm Excel Worksheet Functions 3 April 27th 06 11:40 PM
Move merged cells with conditional formatting? SpikeUK Excel Worksheet Functions 11 December 8th 05 05:04 PM
Unable to sort in Excel because of merged cells Bruce Excel Discussion (Misc queries) 5 July 23rd 05 12:21 AM
Merged Cells TerryTutor Excel Discussion (Misc queries) 1 June 14th 05 05:17 AM


All times are GMT +1. The time now is 12:15 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"