• Hi All

    Please note that at the Chandoo.org Forums there is Zero Tolerance to Spam

    Post Spam and you Will Be Deleted as a User

    Hui...

  • When starting a new post, to receive a quicker and more targeted answer, Please include a sample file in the initial post.

Find max value and/or same value among multiple cells

MGUT

New Member
I have a spreadsheet with precincts, candidates and the number of votes each received. I have used an Index/Match/Max string to determine which candidate received the most votes. But this does not work if two or more candidates received the same number of votes. I need to either 1. Check for ties/same values after running my Index/Match/Max string or 2. I need a formula which will show me the max of the cells or if there is a tie. So I have two questions. Is there a way to accomplish number 2, and what's the best way to check for ties among multiple cells?

Attached is an example. the winner column shows the candidate with the max votes. But, if you look at row 5, Candidate 1 and 2 have the same number of votes. So ideally, my formula would return False because there is no real max. A separate formula that would check for ties would also work. Thanks.
 

Attachments

  • Precinct example.xlsx
    9.3 KB · Views: 9
Try this in H2,

=IF(PRODUCT(INDEX(COUNTIF(C2:F2,C2:F2),0))>1,FALSE,INDEX(C$1:F$1,1,MATCH(MAX(C2:F2),C2:F2,0)))

I2,

=IF(H2=FALSE,MODE(C2:F2),"")

Then copy down.
 
That is awesome! I don't know how or why it works but it does. Thanks much! I've been racking my brain trying to figure out a solution. Genius!
 
The formula from Hasseb will give you a tie if any number is repeating twice even if it is not the max value in the range . I made a small modification to his formula, this formula will only give a tie if there is a tie between max values between the columns hope this will help....
=IF(PRODUCT(INDEX(COUNTIF(C2:F2,C2:F2),0))>1,IF(INDEX(MODE(C2:F2),0,1)<>MAX(C2:F2),INDEX(C$1:F$1,1,MATCH(MAX(C4:F4),C4:F4,0))),INDEX(C$1:F$1,1,MATCH(MAX(C2:F2),C2:F2,0)))
 
Hi MGUT,

Well I did not actually understand your requirement. But see the attached file.
I had done below things.
1. Apply CF to highlight max votes
2. In column H put a formula which will put FALSE in case of ties.
3. In column I, I used @Haseeb A formula as I was not sure what is the exact requirement.

Regards,
 

Attachments

  • Precinct example.xlsx
    9.7 KB · Views: 12
The formula from Hasseb will give you a tie if any number is repeating twice even if it is not the max value in the range . I made a small modification to his formula, this formula will only give a tie if there is a tie between max values between the columns hope this will help....
=IF(PRODUCT(INDEX(COUNTIF(C2:F2,C2:F2),0))>1,IF(INDEX(MODE(C2:F2),0,1)<>MAX(C2:F2),INDEX(C$1:F$1,1,MATCH(MAX(C4:F4),C4:F4,0))),INDEX(C$1:F$1,1,MATCH(MAX(C2:F2),C2:F2,0)))

Thank you. that's perfect. Exactly what I was looking for. Much appreciated.
 
Hi MGUT,

Well I did not actually understand your requirement. But see the attached file.
I had done below things.
1. Apply CF to highlight max votes
2. In column H put a formula which will put FALSE in case of ties.
3. In column I, I used @Haseeb A formula as I was not sure what is the exact requirement.

Regards,

Thank you. Great solution.
 
Back
Top