Index Match across multiple columns

excelscope

New Member
Joined
Nov 3, 2023
Messages
1
I am attempting to look up a certain email from multiple columns and return the branch number. This is just a snippet there are a TON of branches with employee emails.
Ex: If I look through columns B, C, and D, for an emaily@gmail.com and then have the function return the branch number.

I was attempting to use an index, match formula but the match function isn't working across multiple columns.

1699048109662.png
 

Excel Facts

Excel motto
Not everything I do at work revolves around Excel. Only the fun parts.
Try:
(This works if the emails are all unique, if they are not, please clarify your rules)
This is for Excel 2016 and later, incl 365. If you have earlier then you need to change enter with CNTR-SHFT-ENTR keystrokes, or use SUMPRODUCT function instead of SUM. You should update your profile to show what version of excel you use.
Mr Excel Questions 71.xlsm
ABCDEF
1
2Branchemailemailemailemail
358email1@gmail.comemailA@gmail.comemailF@gmail.comemailK@gmail.com
4104email2@gmail.comemailB@gmail.comemailG@gmail.comemailL@gmail.com
5153email3@gmail.comemailC@gmail.comemailH@gmail.comemailM@gmail.com
6
7target:Branch
8emailG@gmail.com104<<< 365
9104<<< SUMPRODUCT
10104<<< CNTL-SHFT-ENTR
excelscope
Cell Formulas
RangeFormula
C8C8=INDEX($B$3:$B$5,SUM((B8=$C$3:$F$5)*((ROW($B$3:$B$5)-2))))
C9C9=INDEX($B$3:$B$5,SUMPRODUCT((B8=$C$3:$F$5)*((ROW($B$3:$B$5)-2))))
C10C10=INDEX($B$3:$B$5,SUM((B8=$C$3:$F$5)*((ROW($B$3:$B$5)-2))))
Press CTRL+SHIFT+ENTER to enter array formulas.
 
Last edited:
Upvote 0
An alternative is with Power Query. Create a parameter with your lookup value
Import your table to PQ editor.
Unpivot your columns so that each email is associated in a singular column to the Branch
Import your lookup to the PQ editor
Filter your email list by linking the lookup to the field in question.
Close and load to Native Excel.
This is an effective means if you have lots of columns and rows.
Any updates to your original data is automatically included in your queries when you select Refresh All
 
Upvote 0
Try:
(This works if the emails are all unique, if they are not, please clarify your rules)
This is for Excel 2016 and later, incl 365. If you have earlier then you need to change enter with CNTR-SHFT-ENTR keystrokes, or use SUMPRODUCT function instead of SUM. You should update your profile to show what version of excel you use.
Mr Excel Questions 71.xlsm
ABCDEF
1
2Branchemailemailemailemail
358email1@gmail.comemailA@gmail.comemailF@gmail.comemailK@gmail.com
4104email2@gmail.comemailB@gmail.comemailG@gmail.comemailL@gmail.com
5153email3@gmail.comemailC@gmail.comemailH@gmail.comemailM@gmail.com
6
7target:Branch
8emailG@gmail.com104<<< 365
9104<<< SUMPRODUCT
10104<<< CNTL-SHFT-ENTR
excelscope
Cell Formulas
RangeFormula
C8C8=INDEX($B$3:$B$5,SUM((B8=$C$3:$F$5)*((ROW($B$3:$B$5)-2))))
C9C9=INDEX($B$3:$B$5,SUMPRODUCT((B8=$C$3:$F$5)*((ROW($B$3:$B$5)-2))))
C10C10=INDEX($B$3:$B$5,SUM((B8=$C$3:$F$5)*((ROW($B$3:$B$5)-2))))
Press CTRL+SHIFT+ENTER to enter array formulas.
Excellent options. My only add would be that if the data does shift downwards, the -2 would have to be adjusted based on the start row of the data

in 365, i may approach it this way
Book1
ABCDEFG
1
2Branchemailemailemailemail
358email1@gmail.comemailA@gmail.comemailF@gmail.comemailK@gmail.com
4104email2@gmail.comemailB@gmail.comemailG@gmail.comemailL@gmail.com
5153email3@gmail.comemailC@gmail.comemailH@gmail.comemailM@gmail.com
6
7target:Branch
8emailG@gmail.com104<<< 365
Sheet5
Cell Formulas
RangeFormula
C8C8=INDEX($B$3:$B$5,SUM((B8=$C$3:$F$5)*(SEQUENCE(ROWS($C$3:$F$5)))))
 
Upvote 0
Excellent options. My only add would be that if the data does shift downwards, the -2 would have to be adjusted based on the start row of the data

in 365, i may approach it this way
Book1
ABCDEFG
1
2Branchemailemailemailemail
358email1@gmail.comemailA@gmail.comemailF@gmail.comemailK@gmail.com
4104email2@gmail.comemailB@gmail.comemailG@gmail.comemailL@gmail.com
5153email3@gmail.comemailC@gmail.comemailH@gmail.comemailM@gmail.com
6
7target:Branch
8emailG@gmail.com104<<< 365
Sheet5
Cell Formulas
RangeFormula
C8C8=INDEX($B$3:$B$5,SUM((B8=$C$3:$F$5)*(SEQUENCE(ROWS($C$3:$F$5)))))
Thanks @Momentman , even when using 365 I forget about SEQUENCE and revert to the older ways of indexing rows. If the user doesn't have SEQUENCE then that is the only way I know of.
 
Upvote 0

Forum statistics

Threads
1,224,824
Messages
6,181,186
Members
453,020
Latest member
Mohamed Magdi Tawfiq Emam

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