Learn Excel 2013 - "VLOOKUP for Two Values?": Podcast #1642

If you like this content, please consider visiting the video on YouTube and subscribe to the MrExcel Channel to show your support!
This video has been published on Feb 11, 2013.
By now, we should know to expect the unusual with the "Learn Excel from MrExcel" Podcast Series...Richard wants to use a VLOOKUP to to find two Values, but Bill thinks that there is a better way to achieve the result using =SUMIFs. Following along with Episode #1642, see how MrExcel uses =SUMIFs to show us a more efficient means than using VLOOKUP for this task.

...This blog is the video podcast companion to the book, Learn Excel 2007 through Excel 2010 from MrExcel. Download a new two minute video every workday to learn one of the 512 Excel Mysteries Solved! and 35% More Tips than the previous edition of Bill's book! Power Excel With MrExcel - 2017 Edition

"The Learn Excel from MrExcel Podcast Series"

Visit us: MrExcel.com for all of your Microsoft Excel Needs!
maxresdefault.jpg


Transcript of the video:
MrExcel podcast is sponsored by Easy-XL.
Learn Excel from MrExcel podcast episode 1642: VLOOKUP from two values.
Hey, welcome back to the MrExcel netcast. I'm Bill Jelen.
Today's question is sent in by Richard.
Richard sent in an xlsx file where he's trying to do a VLOOKUP for two different values.
So he's saying, “Hey look, I need to match both the country in column A and the crop in column B. Can I do a VLOOKUP for that?
Well, okay you could.
You could join column A and B and then you know do a CONCATENATE LOOKUP but you know they're not particularly sorted.
So the thing we did last Monday with the OFFSET you know that's not going to work.
Since we're in Excel 2007 which I'm assuming because it's an xlsx file 2007 or newer, why don't we just use =SUMIFS( the plural version because that lets us add up numbers based on multiple conditions.
All right, so this is area harvested.
The highest for area harvested are here.
I want to press F4 one, two times to lock down the rows but not the columns that we want to copy over to production.
Everything will work great Then criteria range one.
All right, so I want to look through all of the countries here.
It has to be the same size and shape as the first area F4.
I want to make sure that is equal to whatever country is chosen here in H2.
I'll press F4 comma and then the next criteria range is the crops here in column B F4 comma and make sure that it is equal to Maize.
Here I'll press F4 one, two, three times to lock down just the column.
So here's our formula up here.
=SUMIFS(C$2:C$23,$A$2:$A$23,$H$2,$B$2:$B$23,$G5) We're summing the area harvested based on everything and A being equal to the country everything and B being equal to the crop and what we should get is Ghana maize 991033 and in fact we can copy this to the right 1870614.
Beautiful right.
Double-click to copy this down.
The thing I like about this is if there's no hit at all so Ghana had no beans dry, so now we have 0 instead of #N/A. That's actually a little bit better than VLOOKUP.
We don't have to use IFERROR to change the #N/As to 0.
There was no area harvested, no production.
That works.
The only reason why I can see that this wouldn't be what you wanted is if you were taking advantage of the VLOOKUP only finding the first match but from what I can see from this data, each country and crop is only in there once so SUMIFS would be the way to go.
Oh hey, I want to thank Richard for sending that question in and I want to thank you for stopping by.
We’ll see you next time for another netcast from MrExcel.
 

Forum statistics

Threads
1,223,702
Messages
6,173,936
Members
452,539
Latest member
delvey

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