Lookup a value across 4 columns?

BrettOlbrys1

Board Regular
Joined
May 1, 2018
Messages
139
Office Version
  1. 365
Platform
  1. Windows
This is a similar question to one I asked previously, but slightly different. I have a source file with 7,000 rows of data in each cell across columns A - Z. Each row corresponds to a specific person (therefore there are 7,000 employees). For each person, there is a unique sales code in column P, a different unique sales code in Q, a different unique sales code in R, and a different unique sales code in S (each person has 4 unique sales codes). Therefore, there are 28,000 unique sales codes in total.

When one of the 28,000 sales codes shows up in a report, I want to identify the Salesperson whose code was used. The Salesperson's name is in column B of the source file.

How do I look across columns P, Q, R, and S for a specific sales code and return the value in column B of that same row?

Thanks

Brett
 

Excel Facts

How to show all formulas in Excel?
Press Ctrl+` to show all formulas. Press it again to toggle back to numbers. The grave accent is often under the tilde on US keyboards.
This is a similar question to one I asked previously, but slightly different. I have a source file with 7,000 rows of data in each cell across columns A - Z. Each row corresponds to a specific person (therefore there are 7,000 employees). For each person, there is a unique sales code in column P, a different unique sales code in Q, a different unique sales code in R, and a different unique sales code in S (each person has 4 unique sales codes). Therefore, there are 28,000 unique sales codes in total.

When one of the 28,000 sales codes shows up in a report, I want to identify the Salesperson whose code was used. The Salesperson's name is in column B of the source file.

How do I look across columns P, Q, R, and S for a specific sales code and return the value in column B of that same row?

Thanks

Brett

Where cell T2 contains the value to look up.

=OFFSET($B$1,(IFNA(MATCH($T$2,P:P,0),0)+IFNA(MATCH($T$2,Q:Q,0),0)+IFNA(MATCH($T$2,R:R,0),0)+IFNA(MATCH($T$2,S:S,0),0))-1,0)
 
Upvote 0
How about
Excel Formula:
=INDEX(B:B,AGGREGATE(15,6,ROW(B2:B10000)/(P2:S10000=X2),1))
Change X2 to the cell with the number you are looking for.
 
Upvote 0
Solution
How about
Excel Formula:
=INDEX(B:B,AGGREGATE(15,6,ROW(B2:B10000)/(P2:S10000=X2),1))
Change X2 to the cell with the number you are looking for.
Fluff, thanks for the formula. Can you explain what each piece of the formula is doing because I modified it based on my actual set of data and it does not work and my file stops responding when the sheet tried to calculate the formula. One thing to note, my "data" is in a table and that is where the calculation is happening too.

My formula is:

=INDEX('DATA'!$B:$B,AGGREGATE(26,6,ROW('DATA'!$B$2:$B$10000)/('DATA'!$Z$2:$AC$10000=$I2),1))

I assumed the "15" in your original formula was referencing column P, so I changed it to "26" because my data actually starts in Z. What does the "6" do in the formula?

Thanks

Brett
 
Upvote 0
Check Excel's help for information on the Aggregate function. 15 is required.
 
Upvote 0
How about
Excel Formula:
=INDEX(B:B,AGGREGATE(15,6,ROW(B2:B10000)/(P2:S10000=X2),1))
Change X2 to the cell with the number you are looking for.
When I use your formula I get a NUM error.
 
Upvote 0
That suggests that there is nothing in columns P to S that matches the value in X2
 
Upvote 0
That suggests that there is nothing in columns P to S that matches the value in X2
I know that isn't true because I did a find on the first number in my list and it found it in the data file.

Can you confirm these points for me:

- "B:B" refers to the column (in the DATA table) where the Sales reps names are listed and that name will be returned as the result
- "P2:S10000" refers to the columns (in the DATA table) where the Sales reps codes are listed
- "B2:B10000" refers to the column (in the DATA table) where the Sales reps names are listed
- "X2" is the column (in the RESULTS table) where the Sales codes are listed and where the resulting Sales reps names will also be listed once matched

Thanks

Brett
 
Upvote 0
That's right, although the names will be listed where the formula is, not in X2
 
Upvote 0

Forum statistics

Threads
1,223,909
Messages
6,175,310
Members
452,634
Latest member
cpostell

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