Excel VBA Course
Excel VBA Course - From Beginner to Expert

200+ Video Lessons
50+ Hours of Video
200+ Excel Guides

Become a master of VBA and Macros in Excel and learn how to automate all of your tasks in Excel with this online course. (No VBA experience required.)

View Course

lookup 2 values

0

Hi all , 

Im trying to lookup a country name and date to show data in two different rows, ive attached file which should be easier to understand what Im looking for. I hope you can help thank you so much. Ive tried index  match index but not really knowing what im doing, very new to this. Thanks again

Answer
Discuss

Answers

0
Selected Answer

Alaya

You don't want VLOOPUP or INDEX/MATCH here- you need the SUMIFS function. That adds values if several criteria are met (IFS). It's like the SUMIF function but you can narrow it down using a second (or more) criteria.

In the attached revised file, cells M1 and N1 are yellow (your search criteria) and the formula for O16 (summing values in column E) is:

=SUMIFS(E:E,C:C,"=" & $M$1,D:D,"=" & $N$1)

i.e. add the values in column E if the value in C matches M1 AND the value in D matches N1.

The formula for P16 is very similar, same criteria but you sum for column H rather than E:

=SUMIFS(H:H,C:C,"=" & $M$1,D:D,"=" & $N$1)

You can find out more about SUMIFS via Don's tutorial here: SUMIFS - Sum Values Based on Multiple Criteria in Excel

Hope this helps.

Discuss

Discussion

Hi John, 

This is great and works well, thank you so very much. I wil keep learning
Thanks again 
Alaya108 (rep: 4) Mar 9, '22 at 12:36 pm
Add to Discussion


Answer the Question

You must create an account to use the forum. Create an Account or Login