Looking for value across multiple arrays on multiple tabs

caspito

New Member
Joined
Oct 5, 2015
Messages
8
Hello all, I'm new around here and already you guys have been awesome with helping me get better at Excel. I am learning a lot and am very grateful for this forum and its members.

So, I have a column of ten values on a tab called HOF in Cells B51:B60. Each of these values represents the ten largest values within four arrays, each on a different tab. The tabs are called 2010, 2011, 2012, 2013, and 2014 and each array occupies B16:N27 on its respective tab. Column A on each tab, specifically Cells A16:A27, lists names of individuals who achieved these values.

I am searching for a lookup formula that can plumb the depths of all five tabs (2010 to 2014) to retrieve the name of the individual from Column A in whose row there is contained the particular value from the HOF tab's Cells B51:B60.

I thought I got close by discovering INDIRECT... Am I on the right track?

Thanks!
 

Excel Facts

Whats the difference between CONCAT and CONCATENATE?
The newer CONCAT function can reference a range of cells. =CONCATENATE(A1,A2,A3,A4,A5) becomes =CONCAT(A1:A5)
Well, you'd think so! I've spent a lot of time trying to get array functions to work with lookup functions, which is kind of what you're looking at with INDIRECT. But I've never managed to get them to work. (Maybe one of the more experienced folks here has a solution.) Even if there is a way, I know that the CONCATENATE function does not work with arrays.

All is not lost though. Since you only need to look at 5 sheets, I created an array function to do a lookup on 2010, then repeated it 4 more times. This makes it fairly long and ugly, but it does work. Since this is an array formula, enter it with Control-Shift-Enter. I assume you plan to put it in A51 on HOF, or maybe C51 on HOF. Anything on row 51 is OK. Then copy it down to row 60.

=IFERROR(INDEX('2010'!$A$16:$A$27,MAX(IF(B51='2010'!$B$16:$N$27,ROW($B$16:$N$27)-ROW($A$16)+1,-999))),"")&
IFERROR(INDEX('2011'!$A$16:$A$27,MAX(IF(B51='2011'!$B$16:$N$27,ROW($B$16:$N$27)-ROW($A$16)+1,-999))),"")&
IFERROR(INDEX('2012'!$A$16:$A$27,MAX(IF(B51='2012'!$B$16:$N$27,ROW($B$16:$N$27)-ROW($A$16)+1,-999))),"")&
IFERROR(INDEX('2013'!$A$16:$A$27,MAX(IF(B51='2013'!$B$16:$N$27,ROW($B$16:$N$27)-ROW($A$16)+1,-999))),"")&
IFERROR(INDEX('2014'!$A$16:$A$27,MAX(IF(B51='2014'!$B$16:$N$27,ROW($B$16:$N$27)-ROW($A$16)+1,-999))),"")

Let me know how it works.
 
Upvote 0
1. What is to happen if multiple names on a single tab and/or multiple names on multiple tabs all have the value that appears on the HOF sheet?

2. You mentioned "four arrays, each on a different tab". Did you mean 5 arrays?

3. Are the names in A16:A27 the same on each tab & in the same order?
 
Upvote 0
Thanks, Eric! It worked!

Also, Peter, thank you for bringing up these necessary clarifications:

1. I hadn't thought of that... I guess if there is a matching value -- they go to the hundredth, so this is a low-probability event. But a not zero-probability event, so I guess I will cross that bridge when and if I ever do get there!

2. Yes, I meant 5.

3. Yes, they are the same every year and in the same order.

Thanks again everyone who helped me!

Best,

Joe
 
Upvote 0
I'm happy it worked! Thanks for the feedback.

Is it possible to modify the formula to display the value of the "header" cell on Row 15 Columns B through N? The "header" cell displays Week 1, Week 2, all through Week 13.

I want to display (next to the individual from Column A's name) the week in which that value was achieved.

Also, next to that, I want to display the name of the tab from which the high value came...

I'm sure its just a few adjustments to the original formula, right? To get the "header" column name (the week), I tried switching ROW to COLUMN and switching +1 with -999, but no dice. Am I hot or cold?

Thanks!
 
Upvote 0
You had the right idea! This will give you the header cell, put this formula in D51 and copy it down:
Code:
=IFERROR(INDEX('2010'!$B$15:$N$15,MAX(IF(B51='2010'!$B$16:$N$27,COLUMN($B$16:$N$27)-COLUMN($B$16)+1,-999))),"")&
IFERROR(INDEX('2011'!$B$15:$N$15,MAX(IF(B51='2011'!$B$16:$N$27,COLUMN($B$16:$N$27)-COLUMN($B$16)+1,-999))),"")&
IFERROR(INDEX('2012'!$B$15:$N$15,MAX(IF(B51='2012'!$B$16:$N$27,COLUMN($B$16:$N$27)-COLUMN($B$16)+1,-999))),"")&
IFERROR(INDEX('2013'!$B$15:$N$15,MAX(IF(B51='2013'!$B$16:$N$27,COLUMN($B$16:$N$27)-COLUMN($B$16)+1,-999))),"")&
IFERROR(INDEX('2014'!$B$15:$N$15,MAX(IF(B51='2014'!$B$16:$N$27,COLUMN($B$16:$N$27)-COLUMN($B$16)+1,-999))),"")
The one for the sheet name is a bit easier:
Code:
=IF(MAX(IF(B51='2010'!$B$16:$N$26,1,0))=1,"2010","")&
IF(MAX(IF(B51='2011'!$B$16:$N$26,1,0))=1,"2011","")&
IF(MAX(IF(B51='2012'!$B$16:$N$26,1,0))=1,"2012","")&
IF(MAX(IF(B51='2013'!$B$16:$N$26,1,0))=1,"2013","")&
IF(MAX(IF(B51='2014'!$B$16:$N$26,1,0))=1,"2014","")
Here's how the "header" formula works, so you can see what's going on. I'll just look at the top line (2010), the rest work the same.

Consider this formula: IF(B51='2010'!$B$16,COLUMN($B$16)-COLUMN($B$16)+1,-999) and let's say it is not true. Then it will return -999 as a result.

Now consider: IF(B51='2010'!$C$16,COLUMN($C$16)-COLUMN($B$16)+1,-999) and let's say it is true. Then it will return COLUMN($C$16)-COLUMN($B$16)+1, or 3-2+1 = 2, which is the column offset into the range.

Here's where the array part kicks in. If you write the formula like IF(B51='2010'!$B$16:$N$27,COLUMN($B$16:$N$27)-COLUMN($B$16)+1,-999) and tell Excel that's it's an array formula by typing Control-Shift-Enter, then Excel will look for the range in the formula ($B$16:$N$27) and calculate the result for every cell in the range and return all the results in an array, like {-999, 2, -999, -999, -999, . . . -999}. According to what you said, there should only be 1 match, so there will be 1 value that's a column offset, and the rest will be -999. Now we have to compress the array down to 1 value. The MAX function will pull the value 2 from that array.

Now this function: INDEX('2010'!$B$15:$N$15, 2) pulls the second value from the $B$15:$N$15 range, or "Week 2".

If on Sheet 2011, the value in B51 is not found at all, then the array will be all -999, and the max of the array will be -999. Then we'll end up trying INDEX('2011'!$B$15:$N$15, -999). This will create an error, which is why I wrapped the whole thing in IFERROR. If there's not an error, like "Week 2", it returns "Week 2", if there is an error, it returns "". Then finally, the & operator concatenates all five results together.

Given that explanation, go back to the first formula and see what you needed to change.

I'll leave the second formula for you to figure out as an exercise for the reader (I've always wanted to say that!).
 
Upvote 0
If the 5 'year' sheets have identical layouts (& this will always be the case) including names in A16:A27 and week labels in B15:N15 and that you want to report the sheet name where the value occurs, then you could try these formulas which don't require array entry but one of them does require Excel 2010 or later.

Also pointing out that INDIRECT is a volatile function so keep that in mind if your workbook's performance deteriorates.

You say you don't expect there to be more than one occurrence of one of the maximum values. If that does occur, the way my formulas are structured, only one will be reported and it will be the one on the 'earliest year' sheet & if multiples occur on that sheet then it will use the 'earliest week' and if multiples occur in that year and week then the 'earliest row' will be used. The value 2000 on the '2010' sheet demonstrates this.

Showing the 2010 sheet only for the year sheets for ref by the previous paragraph.

Excel Workbook
ABCDEFGHIJKLMN
15Week 1Week 2Week 3Week 4Week 5Week 6Week 7Week 8Week 9Week 10Week 11Week 12Week 13
16Name 12146249034468192466211
17Name 284335522000191938535142394
18Name 3384122000102859880654910054
19Name 45639200066685478254257857
20Name 571200066666618376784786
21Name 63013546665563275981546
22Name 760468353257698649436572555
23Name 881200025401918781900096813820
24Name 963712884100282000513337312037
25Name 1080152542638386859311538620
26Name 115548692446304832854034032
27Name 12355724496326884969793469
2010




Each formula below is copied down.

Excel Workbook
BCDE
50Top 10NameWeekSheet
5110000Name 3Week 52014
529000Name 8Week 92010
538000Name 11Week 32012
547000Name 1Week 82012
556000Name 1Week 112012
565000Name 7Week 112011
574000Name 4Week 22013
583000Name 8Week 82014
592000Name 5Week 22010
601000Name 10Week 72011
HOF
 
Upvote 0
Wow, Peter! Very clever. I've spent some time deconstructing your formulas, and they definitely show that you have a lot of experience.

These will go into my notes.
 
Upvote 0

Forum statistics

Threads
1,223,231
Messages
6,170,884
Members
452,364
Latest member
springate

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