find a value in a column with duplicates and return first value

smgomez

Board Regular
Joined
Nov 13, 2009
Messages
63
I want to find the value in A1 in column F and return the corresponding date in column E in cell A2 as shown below. I am trying to avoid creating a lookup table and vlookup to do it. Column E and F have duplicates so I just need the date upon the first match of the value.

ABCDEF
147.0048.0049.00datevalue
21/1/20213/1/20185/1/20191/1/202147.00
33/1/201848.00
43/1/201848.00
55/1/201949.00
65/1/201949.00

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

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

Excel Facts

Who is Mr Spreadsheet?
Author John Walkenbach was Mr Spreadsheet until his retirement in June 2019.
But you already have a lookup table and vlookup is the best solution here:


Excel 2010
ABCDEF
1474849datevalue
21/1/20213/1/20185/1/20191/1/202147
33/1/201848
43/1/201848
55/1/201949
65/1/201949
Sheet11
Cell Formulas
RangeFormula
A2=VLOOKUP(A1,CHOOSE({2,1},$E$2:$E$6,$F$2:$F$6),2,0)
 
Upvote 0
ok, let me add additional info. The info in columns E and F are in a separate worksheet and I need to include the entire column versus rows 2-6 in the example above which is oversimplified. I tried to adjust per your formula recommendation as follows but it did not work, the result is #N/A: =VLOOKUP(A$1,CHOOSE({2,1},Sheet2!$B:$B,Sheet2!$A:$A),2,0) what is the {2,1} accomplishing in this formula and please advise how to make it work when the data is not in a range on another sheet potentially somewhere in the entire column. Thanks!
 
Upvote 0
Don't use the entire column! That's over 1 million rows (or 65k+ in Excel 2003 and earlier) and very inefficient. If you actually have that much data Power BI is a far better approach. The formula looks up A1 in Sheet2!A:A and returns the adjacent value in Sheet2!B:B but be sure the range contains the same value--not the value with an extra space or stored as text while the other is a number.
 
Upvote 0
Try INDEX/MATCH

A2 copied across
=INDEX(Sheet1!$A:$A,MATCH(A$1,Sheet1!$B:$B,0))

M.
 
Upvote 0
=VLOOKUP(A$1,CHOOSE({2,1},Sheet2!$B:$B,Sheet2!$A:$A),2,0)

If Marcelo's formula works for you then this should also:

=VLOOKUP(A$1,CHOOSE({2,1},Sheet2!$A:$A,Sheet2!$B:$B),2,0)

(It was backwards. The choose array reverses the two columns for a left lookup effect)
 
Last edited:
Upvote 0

Forum statistics

Threads
1,214,376
Messages
6,119,180
Members
448,871
Latest member
hengshankouniuniu

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