Lookup value in A, and return first non-null value in B

RapidFireGT

New Member
Joined
Mar 25, 2008
Messages
26
I'm looking for a formula to place in column C that will look for the value of A1 in column A, and then return the first non-null value in column B. Google seems to indicate that an INDEX/MATCH formula would be the way to go, but I can't seem to get it right as I admittedly haven't worked with INDEX/MATCH much in the past. Any help would be much appreciated!

Thanks in advance,

TABLE AS IT IS:

ABC
Joe
Joe111
Joe
Matthew
Matthew
Matthew
Matthew222
Matthew
Steve
Steve
Steve333
Steve

<tbody>
</tbody>


DESIRED RESULT:

ABC
Joe111
Joe111111
Joe111
Matthew222
Matthew222
Matthew222
Matthew222222
Matthew222
Steve333
Steve333
Steve333333
Steve333

<tbody>
</tbody>
 

Excel Facts

Control Word Wrap
Press Alt+Enter to move to a new row in a cell. Lets you control where the words wrap.
1] Assume table has header and data in A2:B13.

2] In C2, copied down :

=LOOKUP(9^9,$B$2:$B$100/($A$2:$A$100=A2)/($B$2:$B$100>0))

Regards
Bosco
 
Upvote 0
@ bosco_yip:

Two things with your formula:
- it does not work for 0's in column B;
- it will return the last non-zero value for the match in column A.

Here is my take on it. This is an array formula (to be entered using Ctrl+Shift+Enter, not just Enter):

=INDEX($B$2:$B$100,MATCH(TRUE,IF($A$2:$A$100=A2,$B$2:$B$100&"","")<>"",0))
 
Upvote 0
In C2 control+shift+enter, not just enter, and copy down:

=LOOKUP(9.99999999999999E+307,IF($A$2:$A$13=$A2,IF(ISNUMBER($B$2:$B$13),$B$2:$B$13)))
 
Upvote 0

Forum statistics

Threads
1,215,059
Messages
6,122,918
Members
449,094
Latest member
teemeren

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