Make a simple safer version of VLOOKUP and INDEX MATCH
The majority of Excel users use VLOOKUP to get exact matches from a row or column, It would be good if they all used INDEX MATCH but it's more complex so how about this simpler version for the masses.
=GETMATCH(ReferenceToMatch, MatchColumn/Row, GetColumn/Row, Optional Value if no match)
If seen a few other references to updating VLOOKUPS and there are lots of opportunities, but it would be good to address the simple most widely used issue first.
Thanks for the votes! Based on your feedback/votes we’ve just announced the new XLOOKUP function. You can read more about it here: https://techcommunity.microsoft.com/t5/Excel-Blog/Announcing-XLOOKUP/ba-p/811376
Crispo Mwangi commented
VLOOKUP can do as much as INDEX/MATCH if you nest other functions.
It can even do a right side lookup. See article
Wow, I’ve not been getting alerts on updates to this so apologies for my lack of response. I’ll double down on my efforts of promoting this now. P.S. thanks Mark and Greg
Sorry I can't read 102 comments to see if this is already mentioned but my ideal vlookup would be:
xlookup(what to find [string], where to find [range], column heading name to find in [string],
Column header name to return [string], orientation [vertical or horizontal], find which [first - first match, n - nth match, No multi -error if multiple matches or return only one])
[ ] are attributes for the variables required
[string] would be a “string” or a cell reference that returns a string. In this context a string would be anything (strings, integers, numbers) as now.
Column heading name - could be a string “name” or a reference to a excel table column (table1[Name]) as in this context that makes more sense than a reference to the header of that table column (table1[[#Headers],[Name]]). I guess it would also need to have a number offset, as now, to maintain compatibility and to help those that use a formula to derive the number (its March so offset by 3 type of logic)
This lets you;
- look in any column on a range (no more 1st column only)
-Return any result from a column either before or after the searched one.
-It is driven by column headings not column offset which means changing the table (adding columns, changing order) doesn’t break it (but changing column headings could)
-orientation – allows it to be vlookup or hlookup – default would be vlookup
-find which – defaults to first match but can return a specific one (the 3rd match) and more importantly can return an error when more than one result exists.
Overall this should behave as if I had joined the two tables in (power) Query, once the join is made I can return any column I choose and it errors if I create a many:many or works with a 1:many.
I already have something similar to this in vba and it works perfectly with Excel tables, which are fantastic.
VLOOKUP ALWAYS LOOKS UP ON RIGHT SIDE. ITSEAR DOES NOT CHECK FOR COLUMNS TO THE LEFT SIDE. WE NEED THIS FEATURE AS WELL. HOW ABOUT USING NEGATIVE COLUMN NO. FOR EXAMPLE,
VLOOKUP(SEARCH CELL REF, AREA TO CHECK, -2, FALSE)
The best tip about INDEX/MATCH actually came from Wyn Hopkins himself and in my opinion its genius.
Set-up an autocorrect to replace "iii" with =INDEX( DblClk_to_Select_Column_to_return, MATCH( DblClk_Single_Lookup_Cell, DblClk_Lookup_Column, 0),0).
Then all you need do is type "iii" in a cell and press enter. Now edit the equation that shows the above and use the names to remind you what reference to put where.
The webpage where I found this is: http://www.contextures.com/newsletter/excelnews2016/20160503ctx.html
Excel Help commented
Once I learned INDEX/MATCH, I never looked back. As most people point out, it is powerful and gets the job done. However... beginners usually learn VLOOKUP/HLOOKUP first and when I try to convert er...I mean, teach them INDEX/MATCH, the experience is harrowing because the argument order is reversed and the argument terminology is different. I've literally seen a coworker post a sticky on their well with both formulas written out and arrows describing how the arguments relate to each other. That's the kind of end user we're talking about here, the kind that is less technologically inclined than all of us here on uservoice.
If MSFT or the community believes that keeping VLOOKUP is important, at least consider standardizing the order and wording of the function with its more powerful cousin.
while you're about it, add a variable for getting the nth instance of a match too!!!
=GETMATCH(ReferenceToMatch, MatchColumn/Row, GetColumn/Row, Optional Value if no match, optional instance of match)
Col Delane commented
Greg: We'll have to agree to disagree, as I will not hesitate to call out flawed reasoning or specious arguments, even on forums such as this.
I've seen far too many so-called expert/gurus/bloggers who write about what they perceive as "problems" with VLOOKUP or "disadvantages" when unfairly comparing it to an INDEX/MATCH combination (e.g. can't look left, easily corruptible when inserting columns, etc.) - when their claims just don't stack up. VLOOKUP can look left when nested with CHOOSE, and can handle inserted columns when nested with any one of three functions.
I don't believe VLOOKUP is difficult to comprehend - after SUM it was one of the first functions I learned to use. If a user can only use single function formulas then they haven't progressed very far.
Wyn can write nested functions with his eyes closed. But this isn't about him or you or me or any expert/guru/MVP. It's about the END USER. It looks like in his experience, dealing with thousands of end users, they struggle with nested functions, especially if they don't use them often. By making this suggestion he is trying to make the life of the end user simpler, and thereby maybe more effective or less error prone. It's these incremental step changes that continue to make Excel better.
Please do not criticize contributors or their suggestions in this forum. By all means critically assess their proposal and if you disagree then state why and propose a better solution. In short: if you have nothing constructive to say, say nothing.
Col Delane commented
"Most users just need an exact version of INDEXMATCH without having the complexity of a formula embedded inside another formula."
Seriously? How did anyone ever get to be an expert/guru/MVP without nesting functions??
Tom, I agree with you that INDEX MATCH MATCH is really powerful and I am by no means suggesting we get rid of it nor VLOOKUP. Having worked with and trained hundreds and hundreds of Excel users I just want something simple that beginners will understand. Most users just need an exact version of INDEXMATCH without having the complexity of a formula embedded inside another formula.
Here's how GETMATCH would work (exactly the same as INDEX MATCH except the order is changed and there are not 2 formula invoived).
=GETMATCH(A1, B1:B10, C1:C10, "No Match")
=GETMATCH( A1, B1:H1, B2:H2, "Match Not Found")
Somehow I am not able to get correct outcome using GETMATCH. Can you please upload a sample of GETMATCH?
Tom Pietrzak commented
The indexmatch combination allows you to reference a row AND column rather than just a row or just a column. This is way more powerful than the one dimensional vlookup or hlookup. Suggest you revisit your proposed GETMATCH function to say something like (Row ref to match, Col ref to match, Row ref lookup, Col ref lookup, Lookup Date Table/Row/Col, Optional value if no match).
This would allow the function to be used one or two dimensionally
I guess I'm not getting it, Wyn.
How are the 'MatchColumn/Row' and 'GetColumn/Row' arguments being generated?
I am not understanding how they would be defined
without using the 2 MATCH functions normally used.
Are they new nested functions?
If they are just functional arguments, how are you determining the values?
Perhaps if you can write out a full sample formula, the light will go on....?
Anil, it’s a simpler version of INDEX MATCH. A single formula that’s easier to understand and write and therefore accessible to more users. Ideally it would have the iferror wrapper built in also to make things even easier.
I do not see a significant difference between your example
and the INDEX function I normally use.
My typical formula is
MATCH(CurrentDate, Data!$1:$1, false),
MATCH("abc", Data!$A:$A, false)), 0)
Other than the terminology, what is the added benefit...?
Cristian Mendes Firmino commented
I really like it! I've always created my own function to solve this problem, but if there were a native function, it would be better.
I like it! Simplicity is always wonderful.
A.C. WILSON commented
This has also been suggested in other posts in this forum.
I favor it, because INDEX(,(MATCH(... is too complex/obtuse for some users, and VLOOKUP(... lacks power & precision.