Do you want to lookup in any column and return the result? Something like this:

In this article, learn how to write necessary Excel formulas to get the result.
Data Setup for looking up in any column
You need to set up your data in below structure. One column with the data you want to get and multiple columns with potential lookup value. For example, team name in column C, member names in columns D:J, as depicted below.

Lookup formula:
Let’s say we want to lookup “Leonard”, who is in the tea “Geeky Group”. Here is the formula.
=XLOOKUP(1,BYROW(D5:J13,LAMBDA(row,COUNTIFS(row,"Leonard"))),C5:C13)
'notes:
'D5:J13 contains team member names
'C5:C13 contains team names
'this will return #N/A if none of the teams contain lookup value - ie Leonard
How does this formula work?
To understand how this lookup in any column formula is working, we need to first understand a few Excel concepts.
- BYROW: This function let’s you define logic or operations that apply consistently for each row of the data. As we want to look in each row of team members and see if any of them is “Leonard”, BYROW is perfect for this operation.
- LAMBDA: We can use Excel’s LAMBDA functions to create custom logic. As we need to check each row of the data to see if any of the members are “Leonard”, I created a LAMBDA to do that operation. LAMBDA(row, COUNTIFS(row, “Leonard”)) will return the count of “Leonard” in the input variable row
So now that you have the basic concepts ready, let’s understand the lookup in any column function. Here is the formula again.
=XLOOKUP(1,BYROW(D5:J13,LAMBDA(row,COUNTIFS(row,"Leonard"))),C5:C13)
'notes:
'D5:J13 contains team member names
'C5:C13 contains team names
'this will return #N/A if none of the teams contain lookup value - ie Leonard
- BYROW(D5:J13,LAMBDA(row,COUNTIFS(row,”Leonard”))): This formula portion tells us how many times “Leonard” appeared in each row of the data. It will be 0 if the team doesn’t contain lookup value and 1(or more) if the team contains the lookup value. For our sample data, this would be {0;0;0;0;0;1;0;0;0}
- XLOOKUP(1, BYROW(…), C5:C13): Now that we know which team has the lookup value (Leonard), we just lookup for 1 (count) in the BYROW output and return the corresponding team name from the column C.
What if there are multiple matching values?
By default XLOOKUP returns the first matching value whenever we have multiple matches. If you want to see all team names for a given person name (for example Amy is in two teams – “Geeky Group” and “99 Not Out”.

In this case, we can use FILTER() function instead of XLOOKUP.
Using FILTER function to return all matching values
Here is the formula to see all team names for a given person.
=FILTER(C5:C13,BYROW(D5:J13="Amy",OR))
'notes:
'D5:J13 contains team member names
'C5:C13 contains team names
'Here we are using an advanced variation of BYROW that applies OR operation on every row of comparison directly. The end result would be a bunch of TRUE or FALSE values, TRUE for teams that contain "Amy" and FALSE for rest of the rows.
This formula uses an advanced variation of the BYROW by doing a comparison directly and applying OR operation on each row of comparison. The result of BYROW would be an array of TRUE or FALSE values. TRUE for rows which contain Amy and FALSE for the rest.
When FILTER(C5:C13 …) sees this array of TRUE/FALSE values, it would return the matching items from C5:C13 for all TRUE values.
In this case, the output is shown below.

Further reading:
If you want to understand how the inner parts of this formula are working, refer to below articles / videos.
- How to use XLOOKUP function in Excel
- BYROW explained with examples
- What is LAMBDA function in Excel
- How to use FILTER function in Excel
- FILTER function in Excel – Video
Limitations of both formulas
Both of the above approaches (XLOOKUP and FILTER) only work with Excel 365 as BYROW is only available in that version of Excel. If you are using an older version of Excel (such as 2024, 2019 or 2016) you can’t use these approaches.
Alternative formula for older version of Excel
There is no alternative for the FILTER() approach as older versions of Excel are not capable of spilling values. But there is an alternative to XLOOKUP() approach of returning the first matching value by looking up any column.
Here is the formula:
=INDEX($C$5:$C$13,MATCH(1, MMULT((D5:J13="Leonard")*1,TRANSPOSE(COLUMN(D5:J13)^0)),0))
'notes:
'D5:J13 contains team member names
'C5:C13 contains team names
Using MMULT to mimic BYROW operation
Most of the above formula is easy to understand, but the bit with MMULT is the confusing part. So let me explain. Here is the MMULT portion: MMULT((D5:J13=”Leonard”)*1,TRANSPOSE(COLUMN(D5:J13)^0))
- (D5:J13=”Leonard”) checks every cell of the team member data and returns a bunch of TRUE or FALSE values. TRUE when the cell value is “Leonard” and FALSE otherwise. This is how that output looks like:

- (D5:J13=”Leonard”)*1 turns this boolean array into a bunch of 0s & 1s (0 = false and 1 = true). So the output at this point would be:

- COLUMN(D5:J13) would return the the column numbers for columns D to J. This would be an array of {4,5,6,7,8,9,10}
- TRANSPOSE(COLUMN(D5:J13) turns these numbers into a row-wise array. So the net result at this point is {4;5;6;7;8;9;10}
- TRANSPOSE(COLUMN(D5:J13)^0 takes all these numbers and makes them 1s as any number raised to the power of 0 would be. We just need a row-wise array of 1s same size as the number of columns in the team member array. So this is a long-winded way of getting there as older versions of Excel don’t have SEQUENCE formula. At this stage, our second part of MMULT operation has this array: {1;1;1;1;1;1;1}
- Now, MMULT just multiplies these two matrices. Here they are again:

- When the matrix multiplication is done, we end up with a vertical (row-wise) array of 0s and 1s. 0 when the row doesn’t contain the lookup value (Leonard) and 1 otherwise. The result of this multiplication is:

Let’s put everything together
So now that we know how the MMULT magic is working, let’s put all the pieces together.
=INDEX($C$5:$C$13,MATCH(1, MMULT((D5:J13="Leonard")*1,TRANSPOSE(COLUMN(D5:J13)^0)),0))
'notes:
'D5:J13 contains team member names
'C5:C13 contains team names
INDEX($C$5:$C$13,MATCH(1, MMULT(…), 0)) simply looks for a 1 in the MMULT result and returns the corresponding value from range C5:C13.
Further reading on older Excel formulas:
Please refer to below pages for further learning on these formula techniques.
- INDEX + MATCH formula in Excel – explanation
- SUMPRODUCT explained
- How to use boolean operations with arrays in Excel
- MMULT examples
Example Workbook: Lookup in any column
If you need a practice file to understand these formulas better, download it here.
In conclusion
While Excel’s lookup functions (XLOOKUP, VLOOKUP, FILTER, INDEX+MATCH) are great, they all suffer from one nagging limitation. They can only lookup in one place at a time (ie one column or row). But most of the time, our business data is not so tidy. We get data that can span multiple columns. In such cases, using the BYROW() to process one row at a time and then applying lookup or filter logic is a great alternative.
Moreover, if your data is structured vertically (ie team members are listed in rows instead of columns), we can use the same approach with BYCOL function. It applies the logic by column.
The BY functions (BYROW and BYCOL) are great addition to Excel and should be part of every analyst’s toolkit. Using them solves many tricky data problems easily.
40 Responses to “Lost Excel Functions”
Of all the functions, I think the BAHTTEXT function is the biggest "Why is this here???"
It's use would be limited to a very, very small demographic. A better function would have been a generic translate function where you pick the language (even if it was only the top 5 or something...)
Lost by whose definition? Some people use these functions(me). There are alot of words in English dictionary that aren't used.
This is a great post, especially because I love Lost. Thanks!
See the following blog post on Excel Semi-Pro which identifies the flaws with the DATEDIF function.
http://excelsemipro.com/2011/01/how-many-years-months-and-days-has-it-been/?utm_source=feedburner&utm_medium=feed&utm_campaign=Feed%3A+ExcelSemi-pro+%28Excel+Semi-Pro%29
Nice Post Hui. It is amazing what is in the program that you have never heard of. I typed in =d and looked at the functions. "Delta" popped out although it is documented, why would you ever use it vs. just comparing with an equal sign (=1=1).
I use Datedif at times. What will be nice is if alternatives to these "Lost" functions can also be posted with examples. That'll be a good reading and also deter users from using functions "soon to be made obsolete"
I don't think the intersect AND logic is very well documented:
=B1:B3 A2:C2 One intersection
=SUM(D9:F9 E8:F10) Two intersections
=SUM(D9:F9 E8:E10 F8:F10) No intersection --> #NULL! Not seen very often
There might be a OR logic lurking as well
//Ola
Interesting post! 😉
I found out that only "evaluate" isn't available in my excel 2007.
Great post, thanks Hui! 🙂
@Fred
Evaluate is a Excel 4 Macro Function and not a spreadsheet function
It can only be used in Named Ranges and VBA, not as a spreadsheet function.
@OlaSa
I forgot all about the 2 Operators you mention.
Daniel at Excel Hero has done a story about them at: http://www.excelhero.com/blog/2010/06/which-function-to-use---part-1.html
@Steve T
Yes, Delta and Gestep are odd functions and easily replaced with alternative logic.
These 2 functions may have uses in handling ranges and not just single cells.
I read somewhere not too long ago (at Daily Dose, possible) that BAHTTEXT is "rumoured" to be a self-interested joke by the MS Excel programmers: although this function would be at least equally useful for other currencies, they did the baht first because they're extremely partial to Thai takeaways and wanted to speed up the turnaround time
...and why isn't there a reverse ROMAN?
there is, just replace Roman with Arabic
=ROMAN(2023) is MMXXIII
=ARABIC("mmxxiii") is 2023
Hi Hui,
I think you have mis-defined the Result range name because you have made the name relative. The proper formula should have been
=EVALUATE($A$1).
NB: I use the technique in this post: http://www.jkp-ads.com/articles/chartanequation00.asp
Found this posting with some User Defined Functions and VBA for reversing Roman Numerals:
http://www.excelbanter.com/showthread.php?t=141566
Hi Hui - Thanks for the post - a little off the excel topic, but wondering what does "you"ll be the full bottle" mean? Have never heard this expression before. 🙂
@Tra
“you'll be the full bottle” is Aussie slang for "You'll know all about it"
@Jan Karel Pieterse
Thanx for the input
.
=Evaluate(A1) is ok as long as A1 is the active cell
It can create problems if it isn't.
.
Ideally it should be entered as =EVALUATE(SheetName!$A$1)
I have updated the post accordingly
Further info on DELTA:
Have 1 cell formatted to number (a1), and the other formatted to text (a2).
Type the number 1 into both cells
The formula:
=A1=A2
returns FALSE (number does not equal text)
formula:
=DELTA(A1,A2)
returns 1 (the equivalent of true). I see limited places where this would be useful, but wanted to point out that they do function differently.
In Excel2010
I just tried Delta with
2 2 =Delta(A2, B2) =1
'2 '2 =Delta(A3, B3) =1
'2 2 =Delta(A4, B4) =1
C C =Delta(A5, B5) =#Value!
Lines 3 & 4 should also give errors but don't ?
The formatting of the cells shouldn't affect the results as that is just for display
Great post.
Interesting that the roman function returns a #value! if you go any higher than 3999
@Chandoo Not trying to be a shameless self promoter (I just want to spread the Excel awesomeness) but I've found an obscure way to create a mouse-over effect in Excel using the Hyperlink() formula and some VBA. I've used this technique in some of my dashboards at work, and as an example of how it's useful, you could use it in the Grammy Bump chart to simply let users rollover a year instead of clicking on it. I talk about it in the latest post of my rarely updated blog which is linked on my name in this post. Or, here's the long and short of it:
.
=HYPERLINK(MyFunction(), "Mouseover me!")
.
Then in some module:
Public Function MyFunction()
Msgbox "hi!"
End Function
.
To test: place your mouse over the underlined portion of the cell. To make the entire-cell a mouse over target (not just the underlined portion), word wrap it. Also, if you want the function to change parts of your spreadsheet, you'll need to wrap the Hyperlink formula in an IFERROR (you'll see what I mean when you try it). Or you can read about it by clicking on my name, either way, make sure to have fun!
@Hui
Seems like DELTA has the advantage in being able to recognize "text as numbers". And yes, thanks for clarifying my statement about formatting. I should have been clearer in the fact that I just wanted to compare a text string with a number...in which case, maybe I should have just written:
=DELTA(1,"1") 'Results in 1
@Jordan... wow, that is a beautiful trick. I have not yet tested it, but seems like it has lots of potential. Let me play with the idea and may be write a follow-up article on this.
Btw, you are welcome to share information and links. That is the whole point of commenting. 🙂
Alright, i am no engineer, but a simple formula can also do what Delta does without having a whole function for it. That is like creating a function called Add (Syntax =Add(a1,a2) that results in the addition of A1+A2
This will do what delta does on numbers and textNumbers and its not rocket science or structural engineering 🙂 🙂
=VALUE(A1)=VALUE(A2) will also yield true/false
And if you need the result as a number =(VALUE(A3)=VALUE(A4))*1
@SteveT
You know, they invented this function you described in Excel. It is called SUM, not ADD 🙂
There are also functions PRODUCT, SUMPRODUCT and others. All of them simple definied, and it doesn't mean they aren't to be in Excel.
Of the under-used functions, I think Evaluate is probably the most useful.
The short UDF presented here:
http://newtonexcelbach.wordpress.com/2008/04/22/evaluate-function/
allows Excel to evaluate functions entered as text, without the need to create named ranges.
An application using this function can be downloaded here:
http://newtonexcelbach.wordpress.com/2008/03/25/section-properties-of-defined-shapes-spreadsheet/
thanks for this. I hope to use "convert" more frequently henceforth
@ruvelk and @Chandoo
I checked out the link you provided (ruvelk) and the explanation given of the intervals 'MD' 'YM' AND 'YD' provided above (Chandoo) and the information is not quite correct.
'MD' returns the number of days since the last completed month.
'YM' returns the number of months since the last completed year.
'YD' returns the number of days since the last completed year.
As far as I can see there is no flaw in the function just perhaps a misunderstanding of what is does.
eg
using the 'MD' interval
02/28/2010 to 01/11/2011
Last completed month = 12/28/2010
Number of days between 12/28/2010 and 01/11/2011 = 14
Using 03/01/2010 to 01/11/2011
Last completed month = 01/01/2011
Number of days between 01/01/2011 and 01/11/2011 = 10
Cheers
Andrew
@Andrew
I think we are talking about the same thing in different ways.
From the post:
"md" Days Excluding Years And Months Complete calendar days between the dates as if they were of the same month and same year.
so using your dates
28/2/10 to 11/1/11 will count 29, 30 and 31 as if they are in January and then the first 11 days in January = 14 days.
That is, it is counting the dates as if they are both in January, same year, and so there is 14 days between them.
Hi,
Can any one tell how to enter data into range of cells through a single cell without the help of VBA.
Regards
Chandra
@ Chandra
Can you be more specific?
@Chandra
If you type this into A1:
={1,2,3;4,5,6;7,8,9}
then select A1:C3 and use Control+Shift+Enter
You will get a 3x3 array in A1:C3
The formula in each cell in that range will be:
{={1,2,3;4,5,6;7,8,9}}
Commas separate columns. Semicolons separate rows,
This is of limited use since the cells in this array cannot be individually edited.
There is at least 1 Excel 4 macro that provides functionality that cannot (AFAIK) be replicated in later versions of Excel. GET.CHART.ITEM is used to get the exact coordinates of chart elements, including the coordinates of individual points in a line graph (or edge and corner cordinates of bars, or columns for those types of graphs). For example:
sngXPos = ExecuteExcel4Macro("get.chart.item(1,1, ""S2P" & lX & """)")
returns the X position of each point in series 2 of a line graph as you iterate from 1 To ActiveChart.SeriesCollection(2).Points.Count
Documentation file for Excel4 macros available at:
http://support.microsoft.com/kb/128185
Excel 2010 has incorporated most (but not all?) of this functionality as described here:
http://blogs.office.com/b/microsoft-excel/archive/2010/02/16/migrating-excel-4-macros-to-vba.aspx
Unfortunately, I don’t see Evaluate working in Excel 2010.
I have Microsoft Office Professional Plus 2010.
When I try it myself, or download the example file, I have #NAME?
result in the cell containing “=Result” formula.
The Evaluate function does work in Excel 2010 and 2013.
It is called from a VBA function, so maybe the problem is that macros are not enabled.
[…] To know how many months are left between TODAY() and date in A1, use = DATEDIF(TODAY(), A1, “m”). Related: How to use DATEDIF function. […]
[…] To know how many months are left between TODAY() and date in A1, use = DATEDIF(TODAY(), A1, “m”). Related: How to use DATEDIF function. […]
I once ran across an undocumented version of GETPIVOTDATA. The syntax was something like "GETPIVOTDATA($A$3, ...", where $A$# would reference the pivot table then you could concatenate text fields to select the specific data you were after. I found this useful as I could use an IF("condition", "place field text", ""). This way if the "condition" was met it would field data requested otherwise nothing was included. This worked well if nested condition were not available. Hope this is clear. I can't find the alternate syntax for GETPIVOTDATA anywhere. Does someone have it?
@Marty
Yes, GetPivotData is a usefull function but I believe it has been documented since 2007
https://support.office.com/en-us/article/GETPIVOTDATA-function-8c083b99-a922-4ca0-af5e-3af55960761f