Situation
There is no argument that VLOOKUP is a beautiful & useful formula. But it suffers from one nagging limitation. It cannot go left.
Let me explain, Imagine you have data like below. Now, if you want to find-out who made $2,133 in sales, there is no way VLOOKUP can come to rescue. This is because, once you search a list using VLOOKUP, you can only return corresponding items from the column at right, not at left.
Data:

One easy fix would be move the sales data to the left of person name. But this is an annoying fix, because, god knows you may want to lookup based on profit values or something else in future. A better alternative is,…
Solution
.., to use a formula combination called INDEX + MATCH (or OFFSET + MATCH would work too).
The basic syntax of this combination is like this: =INDEX(column with data you want,MATCH(value you are looking for, column which contains this data,0)). So, for eg: =INDEX($B$5:$B$17,MATCH(1088,$D$5:$D$17,0)) would find the position of 1088 in list D5:D17 and return corresponding element from B5:B17 (ie the value from left). See more examples below.
Examples:

Sample File
Download Example File – Make VLOOKUP go Left
Go ahead and download the file. It also has some homework for you to practice this formula trick.
Special Thanks to
Prem, Rohit1409, John, Godzilla, Chris Byham, judgepax – Please click on their names to learn even more.


















11 Responses to “MLB Pitching Stats Dashboard in Excel+VBA by our VBA Class Student”
Hey Dan,
Thanks a lot... this is too good 🙂
Awesome stuff Dan! very impressed..
Thanks guys.
Some nice ideas in there, thanks for sharing. I noticed the list with teams has a missing value though ('Arizona Diamondbacks'). Also when manipulating Pivot Tables with VBA you should be really careful not to try to select a value that isn't in the Pivot Table, if you do all hell breaks loose 🙂 That's not the case here but just some advise as I learned the hard way...
Ah.....ya caught me.
dnrTeamName drives both the charts and the drop down list. It refers to:
=OFFSET(PvtTeams!$A$6,0,0,COUNTA(PvtTeams!$A$6:$A$40),1)
If you change A6 to A5, it fixes that little issue.
A better question though, who actually cares about the Arizona Diamondbacks?
🙂
Excellent post. Thanks
Great job, Dan! Thanks a million!
[...] MLB Pitching Statistics Dashboard [...]
Gr8 work Dan
Hi,
I downloaded file, but looks like everything is in xml. Was there suppose to be excel file as well?
Thanks!
I'm late to the party, but seeing this file in action and studying the underlying data in this Excel file has been AWESOME. I have TONS of new ideas to implement in my work files now. THANK YOU Dan and Chandoo!