VLOOKUP with multiple matching IDs

JackDanIce

Well-known Member
Joined
Feb 3, 2010
Messages
9,922
Office Version
  1. 365
Platform
  1. Windows
Hi,

I have some data which I need to aggregate, Excel's consolidation feature works fine for numbers but not strings for understandable reasons.

Column B contains look up values in alphabetical order, data range is $A$4:$CI [last row]

My code currently applies the consolidation feature and outputs the condensed data 2 rows after the [last row] e.g. $A$12:$CI$15 if [last row] previously was 10

I then use VLOOKUP in empty columns (specifically where string values are expected) to fill in these values, but because there are multiple matching IDs in A4:CI10, it returns error.

Aside from a brute, evaluate each column and copy value where condition matches, can anyone suggest anything more elegant?

Effectively ask is:

I want to match on an ID in a list of sorted IDs (A-Z) which includes duplicates but only return a value if it's non-numerical and not empty.

Code or formula suggestions are both welcome.

TIA!
Jack
 

Excel Facts

Did you know Excel offers Filter by Selection?
Add the AutoFilter icon to the Quick Access Toolbar. Select a cell containing Apple, click AutoFilter, and you will get all rows with Apple
If im understanding correctly try something like:

=LOOKUP(2,1/((A2:A10="ID")*NOT(ISNUMBER(0+B2:B10))),B2:B10)
 
Upvote 0
Solution found:
Code:
=VLOOKUP(A19,INDIRECT("$A" &MATCH("*",N4:N14,0)&":$CI$14"),COLUMN(),0)
Code already uses:
VBA Code:
vlookup = "=VLOOKUP($A" & .Row & "," & rngRef.Address & ",COLUMN(),0)"
So just need to adjust the 2nd argument to use the required lookup range
 
Upvote 0
Thanks @steve the fish I keep forgetting about LOOKUP(2/1) but that would work also.

I'm going to see if I can adapt my suggestion as code already uses a similar string for formula and if I can change the input parameter to vary for this - otherwise will try your suggestion :)
 
Upvote 0

Forum statistics

Threads
1,215,046
Messages
6,122,849
Members
449,096
Latest member
Erald

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