Search code examples
excelvbamaxcriteria

Find max value in a column knowing only a part of the value


I'm stuck with finding the max value in a column based on a criteria that I know only a part of it.

Let me explain better, here is my table

enter image description here

What I would like to do is:

1) Find the max number in Column A based on my 1st criteria that is "1".
2) If I have the criteria "1" I would like to find the max number that begins with "1", so in our example the max number would be "10010".

Some tips of how I would obtain this? If you prefer VBA is a valid option also.

Thank you


Solution

  • One option, something like the following:

    =MAX(IF(LEFT(A2:A8,1)="1",A2:A8))
    

    enter image description here

    Array formula, so depending on your version of Excel you may need to confirm with Ctrl+Shift+Enter.