Last active
November 26, 2024 12:32
-
-
Save AMMullan/98f313c60ed6e52826e5aad7c46515d5 to your computer and use it in GitHub Desktop.
Excel Formulas
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Far better alternative to VLOOKUP | |
# Works in both Excel and Google Sheets | |
# VLOOKUP is _NOT_ case-sensitive and doesn't handle situations where the return value is in a column BEFORE the lookup. | |
# This uses a table called Table1 with Name and Age Columns, with the lookup being in cell A1 | |
=INDEX(Table1[Name], MATCH(TRUE, EXACT(A1, Table1[Age]), 0)) | |
# The following does the same but it finds text ANYWHERE inside the cell, rather than an exact value. | |
=INDEX(Table1[Name], MATCH(TRUE, ISNUMBER(SEARCH(A1, Table1[Age])), 0)) | |
# And this will find the last occurrence | |
=INDEX(Table1[Name], LOOKUP(2, 1/(ISNUMBER(SEARCH(A1, Table1[Age]))), ROW(Table1[Name])-ROW(INDEX(Table1[Name],1))+1)) | |
# An alternative, which I didn't know about previously, is XLOOKUP | |
=XLOOKUP(A1, Table1[Age], Table1[Name], "No Matches Found") |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment