2
votes

I am looking for a vlookup formula that returns multiple matches using two lookup values. I am currently trying to use the concatenate method, but I haven't quite figured it out. The table needs to return all of the multiple matches not just one. Currently, its only returning the last match.

For example, lets say I have a list of multiple city and states. The cities differ but the states remain the same obviously. I want to return the number of people in the each city.

City     State   #OfPeople
Albany   NY      10
Orlando  FL      5
Tampa    FL      3
Seattle  WA      1
Queens   NY      8

So I concatenated the city and state column.

Join         City     State   #OfPeople
Albany-NY    Albany   NY      10
Orlando-FL   Orlando  FL      5
Tampa-FL     Tampa    FL      3
Seattle-WA   Seattle  WA      1
Queens-NY    Queens   NY      8

The purpose of this is to create an updated log of people in each city has time progresses. I want to have a grand total amount of people in each column. (I know this requires another formula. I'm just focused on returning multiple matches for now). However, I don't want to overwrite the existing data. Hopefully, I explained this well. This is just an example of a larger project I'm working on. I need to be able to build on this list. That's why its important that I be able to return matches multiple times.

Join         City     State   #OfPeople                 Total
Albany-NY    Albany   NY      10                        10
Orlando-FL   Orlando  FL      5                         15
Tampa-FL     Tampa    FL      3                         18
Seattle-WA   Seattle  WA      1                         19  
Queens-NY    Queens   NY      8                         27

Any help would be greatly appreciated!

2
I don't actually see a question. What are you actually asking?Jerry Jeremiah
Do you know of a vlookup formula that returns multiple matches using two lookup values?Missm
Not sure if this is maybe what you want, but you can (instead of Vlookup()), use Index/Match with multiple criteria. Say you want to return a number from New York, New York, and another from Albany, New York. You can use two variables (city and state) and return a value from a third column.BruceWayne
You may optionally post your solution (formula) as an answer to help others.UndeadBob

2 Answers

0
votes

Considering you're trying to get some grand totals based on multiple criteria, I would suggest using SUMIFS() / COUNTIFS() functions, rather than focusing on searching matching row itself.

However, if you need multiple criteria look up, for some reason, I believe INDEX() + MATCH() combination can perfectly do the job.

0
votes

The table needs to return all of the multiple matches not just one. Currently, its only returning the last match

You'll need to use SUMIFS() if there are multiple records for the same city/state combo in your people lookup.

=SUMIFS (sum_range, range1, criteria1, [range2], [criteria2], ...)

Let's assume that you have a cities tab and a people tab. Let's assume you have ten cities that you want to return the total amount of people from.

Cities Tab definition

City range: 'Cities'!A$1:A$10
State range: 'Cities'!B$1:B$10

People Tab definition

City range: 'People'!A$1:A$100
State range: 'People'!B$1:B$100
#OfPeople range: 'People'!C$1:C$100

Drop this formula in the first row of your cities tab, drag down the entire range of cities.

=SUMIFS('People'!C$1:C$100, 'Cities'!A$1, People'!A$1:A$100, 'Cities'!B$1, 'People'!B$1:B$100)