Search code examples
excelvlookupdistinct-values

Match 2 values across 2 data sets to return third value?


The title isn't very descriptive, but here's a simple explanation of what I have:

Column A: List of fruits (Data set 1)

Column B: List of vegetables (Data set 1)

Column C: A counter for each fruit/vegetable combination of Data set 1 (numbers)

Column E: List of fruits (Data set 2)

Column F: List of Vegetables (Data set 2)

Column G: A counter for each fruit/vegetable combination of Data set 2 (numbers)

Suppose for data set 1, the fruit/vegetable combination of strawberry/carrot (columns A & B respectively) has a counter of 5 (column C) whereas for data set 2, the same fruit/vegetable combination of strawberry/carrot (columns E & F respectively) has a counter of 7 (column G).

Is there an excel formula that searches up each value in Column A/B to Column E/F and returns the respective value in column G? I know that vlookup looks for one specific cell in an array, but I don't think I can look up a unique combination across multiple columns.


Solution

  • Use two concatenated SUMIFS:

    =SUMIFS(C:C,A:A,"strawberry",B:B,"carrot") & "," & SUMIFS(G:G,E:E,"strawberry",F:F,"carrot")