Row with highest value

ngocpdn

New Member
Joined
Jul 12, 2012
Messages
15
Hi!

Need some help with a formula to calculate a discount.

20% off all items EXCEPT the highest value item. Where 2 items are same value, only 1 gets the discount. Here's my example:

408
1000
10020
6012
[td]price[/td]
[td]discount[/td]

This seems to work when there's no duplicates: =IF(A2=MAX(A2:A4),0,A2*0.2)

But I can't get this to work when there's 2 items with the same highest value.

Any tips on how I can get this working?
 

Excel Facts

How to show all formulas in Excel?
Press Ctrl+` to show all formulas. Press it again to toggle back to numbers. The grave accent is often under the tilde on US keyboards.
My take on this
=IF(AND(A2=MAX(A$2:A$5),COUNTIF(A$2:A2,MAX(A$2:A$5))=1),0,A2*0.2)
 
Upvote 0
Quite right, I missed the "only 1 gets the discount" part.
 
Upvote 0
That doesn't quite work if there are more than two duplicates or the highest value occurs in the first row. How about:
=IF(AND(A2=MAX(A$2:A$5),COUNTIF(A2:A$2,MAX(A$2:A$5))>1),0,A2*0.2)
 
Last edited:
Upvote 0

Forum statistics

Threads
1,215,418
Messages
6,124,793
Members
449,189
Latest member
kristinh

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