retrieve value from column based on separate column

dhx10000

Board Regular
Joined
Jul 11, 2005
Messages
144
I have a worksheet that contains data similar to this:

A B
--------- -------------
578 22395
578 22395
625 37553
703 37553
811 49995
811 49995
823 49995

-----------------------------------------------------
I have another sheet where I am trying to do this:

G H
----- --------
578 22395
625 37553
703 37553
811 49995
823 49995

I already know how to generate the "G" column. I am having problems generating the "H" column

Thank you
 

Excel Facts

What do {} around a formula in the formula bar mean?
{Formula} means the formula was entered using Ctrl+Shift+Enter signifying an old-style array formula.
I have a correction to make, what if columns A and B are reversed? Because that is how my data is. I don't think VLOOKUP will work.
 
Upvote 0
That's a good point... I never tried reverse search... Now you made me wonder too...
 
Upvote 0
This is excellent. The last piece of my puzzle is that sometimes my VLOOKUP is returning a 0 in my H column because the H column contains some blanks. Is there any way to tell the VLOOKUP funtion to only return the first non-blank value it comes across, per value in G?

A B
-- --
578
578
578 22995
625
625 36150
735 37555
855 39562


This would in turn look like this:

G H
-- --
578 22995
625 36150
735 37555
855 39562
 
Upvote 0
The safest thing to do might be (if it's random, or you might not find a match) would be to make a copy of your data, then delete the blanks in column B, then do your lookup, e.g., delete code:

Code:
Sub foo()
Range("b:b").SpecialCells(xlBlanks).EntireRow.Delete
End Sub
 
Upvote 0

Forum statistics

Threads
1,224,802
Messages
6,181,048
Members
453,014
Latest member
Chris258

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