Function to find the maximum in range considering the artificial hierarchy placed on prefixed letter values

TonyChestnut

New Member
Joined
Aug 24, 2012
Messages
12
Hi,

Hopefully the title of this thread makes some sense. Let me explain what I am trying to do...

I have a range of values, A1:A5. In this hypothetical situation say that they are the following:

A1 = P1
A2 = T1
A3 = C4
A4 = PC1
A5 = C6

The letter/s on the left relate to a hierarchy where P is the lowest, T is next, then C, and PC is the 'highest'.

What I need is a function (cannot be a macro, and not possible to use helper cells due to the extent of the project) that will return the 'highest' result, first considering the Letter/s on the left, and then the numbers on the right.

The function should return, in the given scenario, the value of A4. If that wasn't there then the value of A5.

I've been ripping my hair out trying various combinations of MAX, IF, SUBSTITUTE, LARGE, VALUE, N, LOOKUP, etc, but I fail everytime.

Please help me win.

Kind regards,
 
My suggested formula should work with any column of data

Hi Harry,

Sorry for the confusion, you're right, but I meant to specify a row...F28:DA28.

How can I edit it to get the 'maximum' from a row?

I've tried breaking down the formula to help me understand what to change, but arrays are very new to me.

Kind regards,

Tony
 
Upvote 0

Excel Facts

How to find 2nd largest value in a column?
MAX finds the largest value. =LARGE(A:A,2) will find the second largest. =SMALL(A:A,3) will find the third smallest
OK try this version

=LOOKUP(2,1/COUNTIF(F28:DA28,{"P","T","C","PC"}&"*"),{"P","T","C","PC"})&MATCH(2,1/MMULT((F28:DA28=LOOKUP(2,1/COUNTIF(F28:DA28,{"P","T","C","PC"}&"*"),{"P","T","C","PC"})&ROW(INDIRECT("1:999")))+0,TRANSPOSE(COLUMN(F28:DA28)^0)))
 
Upvote 0
AmAzInG! Thanks Barry Houdini.

Thanks to Marcol/Marcelo too...I'll keep a record of your solutions for my own learning and future troubleshooting.

This forum is the best by far!
 
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