Calculate Max of several cells and print the associated text

BrerRabbit

Board Regular
Joined
Aug 20, 2023
Messages
70
Office Version
  1. 2021
  2. 2016
  3. 2013
Platform
  1. Windows
Please ignore my previous post.

How do I calculate the max number below and have the answer come back as the three letter code? How do I also just pick teh first instance of there's only one of each?

How do I also delete my previous post?

1 - APP2 - ORA4 - BAN1 - CUC
1 - APP1 - BAN
 

Excel Facts

When did Power Query debut in Excel?
Although it was an add-in in Excel 2010 & Excel 2013, Power Query became a part of Excel in 2016, in Data, Get & Transform Data.
Hi,
unfortunately I don't believe you can solve your '3 letter return' in Excel 2016, due to its lack of array options.

Even with latest Excel365 its a pretty complex formula (but its do-able). I've shared that below (result formula in C5, other formulas as helpers in A5 & B5) for a couple reasons -
a) maybe you upgrade Excel at some point, b) maybe someone else here can find a way in legacy excel by seeing how I did in Excel365).
Sorry its not helpful for you in Excel 2016 directly.

It effectively takes your array of cells, and puts them in a column (removing blanks - as you can see in A5). then scans each and extracts the numbers on the left, then finds the MAX of these.
It then uses this MAX value to search the list again, and returns the value of this cell relating to the MAX. Lastly, it transforms that into the last 3 digits to display.

In terms of your second question, what's the context of your selection of the first instance ? (are you scanning across the columns, down the columns, do they appear in multiple columns etc.). Why do you want/need to select it in the first place ? There is maybe not enough info here for us to advise on that yet.

Book1
ABCDE
11 - APP2 - ORA4 - BAN1 - CUC
21 - APP1 - BAN
3
4
51 - APP4BAN
62 - ORA
74 - BAN
81 - CUC
91 - APP
101 - BAN
Sheet1
Cell Formulas
RangeFormula
A5:A10A5=TOCOL(A1:E2,1)
B5B5=TEXT(MAX(MAP(TOCOL(A1:E2,1),LAMBDA(v,VALUE(LEFT(v,FIND(" ",v)-1))))),0)
C5C5=RIGHT(XLOOKUP(TEXT(MAX(MAP(TOCOL(A1:E2,1),LAMBDA(v,VALUE(LEFT(v,FIND(" ",v)-1))))),0),TOCOL(A1:E2,0),TOCOL(A1:E2,0),,1),3)
Dynamic array formulas.
 
Upvote 0
I played around with it, and I came up with this. I'm surprised that I did. But have you ever noticed that when you ask someone else the question the answer becomes apparent?



12 APP
0​
9 BAN11 GRA
12​

=MAX(IF(B16="","0",LEFT(B16,2)),IF(C16="","0",LEFT(C16,2)),IF(D16="","0",LEFT(D16,2)), IF(E16="","0",LEFT(E16,2)))
Then I wrapped it in Address to find which three letter code was the most and it seems to work.

I've had to do a calendar array where I need 3 bits of information. Excel likes to do one cell one value, whereas I've done 3 different values in one cell. With this I'm counting how many times the three letter code comes up in a particular row. Lets me know how many times that person has done that class. This was the last formula I needed.

Thank you for your efforts though, I appreciate it.
 
Upvote 0
Great - glad you managed to solve your problem..

cheers
Rob
 
Upvote 0

Forum statistics

Threads
1,215,842
Messages
6,127,231
Members
449,371
Latest member
strawberrish

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