Index/Match/Max finds Header info... but how do I deal with duplicate values?

chonchos

New Member
Joined
Nov 4, 2016
Messages
16
First, some background on what I have before we get into what Im trying to do.

The Sheet pulls in data from our external database that details different repair orders. Each row has Company Name, Entry Date, Repair Order Number, Notes, etc.

This sheet is used to assist in managing these orders. We want to make sure that we request the appropriate information at the appropriate time. For example, if we just sent a part off to a shop 2 days ago, we don't want to start hassling them for a quote when the part likely hasn't even been delivered to their door yet. Therefore, the process we follow is laid out in Excel the same way the process flows in real life. We request the quote, we receive the quote, approve or deny quote, request ETA for delivery, and input expected return date when we receive it. If the part is already on site, we don't need to do anything.

Right now, the sheet is complicated and convoluted but I'm doing the best with what I've got. Here is an example of what I'm working with:

HQRZAAABACADAEAF
1ENTRY_DATECURRENT_STATUSWHAT_TO_DOARRIVED ON SITEQuote RequestedQuote ReceivedQuote Not ApprovedQuote ApprovedETA RequestedETA Status Update
25/8/18QUOTE NOT APPROVEDMove Quote5/22/185/23/185/23/18
34/15/18QUOTE RECDEvaluate Quote4/24/185/16/185/16/18
42/1/18ETA REQUESTEDSend Another ETA Request3/20/183/20/183/20/185/7/185/7/18
55/2/18QUOTE APPROVEDRequest ETA5/7/185/7/185/7/185/11/18
64/24/18QUOTE APPROVEDRequest ETA5/4/185/5/185/5/185/5/18

<tbody>
</tbody>

Now, basically this is how it works. All of the date fields (Columns Z through AF) are populated by searching the Notes field (not shown in example) using a nifty VBA script that I actually got assistance with on this wonderful site. Then, CURRENT_STATUS (Column Q) is a formula that finds the max value across the row and outputs the associated Header.

Code:
=IF(ISNA(IF(Z2="",(INDEX($AA$1:$AF$1,0,MATCH(MAX($AA2:$AF2),$AA2:$AF2,0))),"ARRIVED ON SITE")), "NO MOVEMENT", IF(Z2="",(INDEX($AA$1:$AF$1,0,MATCH(MAX($AA2:$AF2),$AA2:$AF2,0))),"ARRIVED ON SITE"))

This formula works great... EXCEPT when there are duplicate values.

So, using the example above, Row 3 has the date 5/16 under both "Quote Received" and "Quote Not Approved". It Returns "Quote Recd" under Current Status. However, we have already received and evaluated this quote. Ideally, in order to keep up with the order in which our processes go, I would like the return value under "Current Status" to be "Quote Not Approved" since it is the last date of movement for this line item. Similar other examples are shown above.

I have racked my brain, googled to no end, and just started trying random adjustments to the "Current Status" formula but I'm not getting the result I'm looking for.

I know this is THE BEST board for Excel problems... so here I am waving the white flag. Please help me! :)
 

Excel Facts

How to total the visible cells?
From the first blank cell below a filtered data set, press Alt+=. Instead of SUM, you will get SUBTOTAL(9,)
How about:

=IF(Z2<>"",Z$1,IF(MAX(AA2:AF2)=0,"NO MOVEMENT",LOOKUP(2,1/(AA2:AF2=MAX(AA2:AF2)),AA$1:AF$1)))
 
Upvote 0
Eric W you are officially my hero.

That works beautifully.

See, this is why I come here. Spend 5 days in agony convincing myself it must be impossible and then I get the perfect, elegant answer 5 minutes after posting a thread.

Now, let me continue on with this sheet and figure out what my next impossible task is. :D

Thank you! You're a gentleman and a scholar!
 
Upvote 0

Forum statistics

Threads
1,214,641
Messages
6,120,692
Members
448,979
Latest member
DET4492

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