Finding a value in a multiple column array and returning column header - Excel 2003

NairbNam

New Member
Joined
Dec 7, 2012
Messages
6
Hi guys first post here.

I am attempting to lookup a cell value in a 3 column by 20 row array. Depending on which column the value is found, I would like to return that column's header value.

I think I am making this overly complicated for myself. Basically I need a statement that will perform an Hlookup on three columns but I'm not sure exactly how to do this.

Any help would be appreciated.

Thanks!
 
Could I use this formula to search multiple sheets? and how?
{=INDEX(A1:C1,MAX(IF(A2:C5=E2,COLUMN(A2:C5)-COLUMN(A1)+1)))}

I think you need to re-think what the output would be...

For example, the MAX value can be associated with the following headers:

Sheet1 >> A1, C1
Sheet2 >> B1, B1
Sheet3 >> A1, B1

I hope you are not going to say that you want them all...
 
Upvote 0

Excel Facts

Format cells as date
Select range and press Ctrl+Shift+3 to format cells as date. (Shift 3 is the # sign which sort of looks like a small calendar).
I need to search the same areas on each sheet. If it doesnt find the value on sheet 1 then search sheet 2 and so on.
 
Upvote 0
Hi, thanks for your reply. The solution worked for F2, but didn't seem to work when copied to other cells..

I changed the cell references to fixed values. The lookup worked for letter h in finding d, but it didnt work for the others.
The yellow highlighted cell should display 'g' and the formula in that cell now reads:

{=IFERROR(INDEX($A$2:$C$5,MIN(IF($A$2:$C$5=E3,ROW($A$2:$C$5)-ROW(A3)+1)), 1/(1/MAX(IF($A$2:$C$5=E3,COLUMN($A$1:$C$1)-COLUMN($A$1)+1)-1))),"")}
Thanks!
lookupresult
Aei hd
Bfj kf
Cgk lf
dhl f

<COLGROUP><COL style="WIDTH: 48pt" span=6 width=64><TBODY>
</TBODY>
 
Upvote 0
Hi, thanks for your reply. The solution worked for F2, but didn't seem to work when copied to other cells..

I changed the cell references to fixed values. The lookup worked for letter h in finding d, but it didnt work for the others.
The yellow highlighted cell should display 'g' and the formula in that cell now reads:

{=IFERROR(INDEX($A$2:$C$5,MIN(IF($A$2:$C$5=E3,ROW($A$2:$C$5)-ROW(A3)+1)), 1/(1/MAX(IF($A$2:$C$5=E3,COLUMN($A$1:$C$1)-COLUMN($A$1)+1)-1))),"")}
Thanks!
lookupresult
Aeihd
Bfjkf
Cgklf
dhlf

<tbody>
</tbody>

Thjs is what I get...

~
Row\Col
A​
B​
C​
D​
E​
F​
1​
Header1Header2Header3LookupSOLUTION
2​
AEIHD
3​
BFJKG
4​
CGKLH
5​
DHLFB

F2, control+shift+enter, not just enter, and copy down:
Rich (BB code):

=IFERROR(INDEX($A$2:$C$5,MIN(IF($A$2:$C$5=$E2,ROW($A$2:$C$5)-ROW($A$2)+1)),
    1/(1/MAX(IF($A$2:$C$5=$E2,COLUMN($A$1:$C$1)-COLUMN($A$1)+1)-1))),"")
 
Upvote 0
Could I use this to search multiple sheets? and how?

Which formula are you addressing?

My apologies. This one.
{=INDEX(A1:C1,MAX(IF(A2:C5=E2,COLUMN(A2:C5)-COLUMN(A1)+1)))}

Could I use this formula to search multiple sheets? and how?
{=INDEX(A1:C1,MAX(IF(A2:C5=E2,COLUMN(A2:C5)-COLUMN(A1)+1)))}

I think you need to re-think what the output would be...

For example, the MAX value can be associated with the following headers:

Sheet1 >> A1, C1
Sheet2 >> B1, B1
Sheet3 >> A1, B1

I hope you are not going to say that you want them all...

I need to search the same areas on each sheet. If it doesnt find the value on sheet 1 then search sheet 2 and so on.

1. Create a range housing the relevant sheet names, select this range, name the selection SheetList.

2. The formula sheet, that is, the sheet the following formulas need to be implemented. Note that the data area in very sheet is A1:C5 with A1:C1 housing the same header fields (in what follows: A1 = VAD, B1 = JAD, and C1 = NAD).

Row\Col
A​
1​
2​
88​
3​
2​
4​
NAD
5​

In A2 control+shift+enter, not just enter:
Rich (BB code):

=MAX(SUBTOTAL(4,INDIRECT("'"&SheetList&"'!A2:C5")))

This yields the MAX value.

In A3 control+shift+enter, not just enter:
Rich (BB code):

=MATCH(TRUE,COUNTIF(INDIRECT("'"&SheetList&"'!A2:C5"),A2)>0,0)

This yields the position in SheetList of the sheet that contains the MAX value.

In A4 control+shift+enter, not just enter:
Rich (BB code):

=INDEX(INDIRECT("'"&INDEX(SheetList,A3)&"'!A1:C1"),
    MIN(IF(INDIRECT("'"&INDEX(SheetList,A3)&"'!A2:C5")=A2,
    COLUMN(INDIRECT("'"&INDEX(SheetList,A3)&"'!A2:C5")))))

This yields the header field under which the first MAX instance is located.
 
Upvote 0
Aladin...I'm trying to search in A1 for any of the strings in A4:H8 then return the corresponding value from column A. For example; I see that the exact string in F7 is located somewhere in A1, so I'd like to return A7 (12oz). Any ideas? Thanks in advance!

Orange Juice 12 Oz Trop
SizesVariations
8oz8Oz8oZ8OZ8 oz8 Oz8 oZ8 OZ
8.4oz8.4Oz8.4oZ8.4OZ8.4 oz8.4 Oz8.4 oZ8.4 OZ
11.15oz11.15Oz11.15oZ11.15OZ11.15 oz11.15 Oz11.15 oZ11.15 OZ
12oz12Oz12oZ12OZ12 oz12 Oz12 oZ12 OZ
14.9oz14.9Oz14.9oZ14.9OZ14.9 oz14.9 Oz14.9 oZ14.9 OZ

<tbody>
</tbody>

I haven't been able to make vlookup or index-match-match work for my purposes.
 
Upvote 0
@yrubin

It looks like the following would suffice...

In B1 enter:
Rich (BB code):

=LOOKUP(9.99999999999999E+307,SEARCH(SUBSTITUTE($A$4:$A$8," ",""),
  SUBSTITUTE($A$1," ","")),$A$4:$A$8)
 
Upvote 0
Amazing!! Would you mind explaining how that works? I get why you'd remove the spaces, but I don't understand the search and output parameters. Thank you so much!
 
Upvote 0
Can someone please help me with this. I have a table as below. I would like to look up a number (say 3454) and return the number in the 1st column. (2)

ABCDLookupAnswer
1123443556 34352
256783435
390123
474547234234

<colgroup><col width="64" span="8" style="width:48pt"> </colgroup><tbody>
</tbody>

<colgroup><col width="64" span="8" style="width:48pt"> </colgroup><tbody>
</tbody>
 
Upvote 0

Forum statistics

Threads
1,215,235
Messages
6,123,786
Members
449,125
Latest member
shreyash11

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top