Return max value based on value in another cell

junkforhr

Board Regular
Joined
Dec 16, 2009
Messages
115
Office Version
  1. 365
Platform
  1. Windows
I have the following dummy table.

Value of Header1 will be in cell A18. Value of Header2 will be in cell A19 and value Header3 will be in cell A20.

I have about 20 headers and I want the highest number in the range based on what is in the relevant cell. The order of the headers may change, so for one month it may not have all 20 options.

Desired result

Header1
13​
Header2
7​
Header3
19​

Row LabelsHeader1Header2Header3Header4Header5Header6Header7Header8Grand Total
11/04/2023
13​
18​
6​
7​
1​
45​
12/04/2023
7​
2​
14​
5​
3​
2​
33​
13/04/2023
7​
3​
9​
4​
5​
1​
29​
14/04/2023
2​
5​
2​
8​
17​
17/04/2023
7​
1​
17​
4​
6​
3​
38​
18/04/2023
13​
1​
14​
2​
3​
1​
34​
19/04/2023
4​
1​
16​
8​
3​
32​
20/04/2023
6​
2​
7​
3​
1​
19​
21/04/2023
10​
1​
10​
3​
4​
28​
24/04/2023
5​
3​
9​
8​
5​
1​
31​
26/04/2023
4​
15​
2​
7​
1​
2​
31​
27/04/2023
5​
7​
1​
2​
1​
1​
17​
28/04/2023
7​
11​
1​
6​
1​
26​
1/05/2023
11​
1​
17​
2​
8​
39​
2/05/2023
9​
15​
1​
5​
30​
3/05/2023
5​
14​
2​
3​
24​
4/05/2023
7​
1​
12​
7​
3​
1​
31​
5/05/2023
13​
12​
1​
2​
28​
8/05/2023
6​
6​
8​
5​
1​
1​
27​
9/05/2023
4​
14​
1​
3​
22​
10/05/2023
12​
1​
4​
3​
8​
28​
11/05/2023
5​
1​
9​
2​
17​
12/05/2023
4​
9​
2​
5​
20​
15/05/2023
6​
19​
3​
8​
1​
2​
39​
16/05/2023
6​
12​
2​
2​
1​
1​
24​
17/05/2023
8​
1​
14​
2​
1​
26​
18/05/2023
12​
15​
4​
12​
43​
19/05/2023
11​
7​
8​
12​
5​
43​
 

Excel Facts

What do {} around a formula in the formula bar mean?
{Formula} means the formula was entered using Ctrl+Shift+Enter signifying an old-style array formula.
Hi @junkforhr , I hope you're doing well.
Thanks for posting on the forum.

Try the following formula. You will have to adjust it to the range where you have the data and where you have the headers.

Dante Amor
ABCDEFGHIJ
1
18Header113
19Header27
20Header319
21
22Row LabelsHeader1Header2Header3Header4Header5Header6Header7Header8Grand Total
2311/04/2023131867145
2412/04/2023721453233
2513/04/202373945129
2614/04/2023252817
2717/04/2023711746338
2818/04/20231311423134
2919/04/202341168332
3020/04/20236273119
3121/04/2023101103428
3224/04/202353985131
3326/04/2023415271231
3427/04/202357121117
3528/04/202371116126
3601/05/2023111172839
3702/05/20239151530
3803/05/20235142324
3904/05/2023711273131
4005/05/202313121228
4108/05/202366851127
4209/05/20234141322
4310/05/202312143828
4411/05/2023519217
4512/05/2023492520
4615/05/2023619381239
4716/05/2023612221124
4817/05/202381142126
4918/05/2023121541243
5019/05/2023117812543
Hoja3
Cell Formulas
RangeFormula
B18:B20B18=MAX(INDEX($A$22:$J$50,0,MATCH(A18,$A$22:$J$22,0)))




--------------
Let me know the result and I'll get back to you as soon as I can.
Cordially
Dante Amor
--------------​
 
Upvote 1
Solution
Hi @junkforhr , I hope you're doing well.
Thanks for posting on the forum.

Try the following formula. You will have to adjust it to the range where you have the data and where you have the headers.

Dante Amor
ABCDEFGHIJ
1
18Header113
19Header27
20Header319
21
22Row LabelsHeader1Header2Header3Header4Header5Header6Header7Header8Grand Total
2311/04/2023131867145
2412/04/2023721453233
2513/04/202373945129
2614/04/2023252817
2717/04/2023711746338
2818/04/20231311423134
2919/04/202341168332
3020/04/20236273119
3121/04/2023101103428
3224/04/202353985131
3326/04/2023415271231
3427/04/202357121117
3528/04/202371116126
3601/05/2023111172839
3702/05/20239151530
3803/05/20235142324
3904/05/2023711273131
4005/05/202313121228
4108/05/202366851127
4209/05/20234141322
4310/05/202312143828
4411/05/2023519217
4512/05/2023492520
4615/05/2023619381239
4716/05/2023612221124
4817/05/202381142126
4918/05/2023121541243
5019/05/2023117812543
Hoja3
Cell Formulas
RangeFormula
B18:B20B18=MAX(INDEX($A$22:$J$50,0,MATCH(A18,$A$22:$J$22,0)))




--------------
Let me know the result and I'll get back to you as soon as I can.
Cordially
Dante Amor
--------------​
Thanks for that, it's exactly what I was after
 
Upvote 0

Forum statistics

Threads
1,215,100
Messages
6,123,086
Members
449,095
Latest member
gwguy

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