+ Reply to Thread
Results 1 to 12 of 12

Detecting same value in 3 cells

  1. #1
    Registered User
    Join Date
    12-21-2008
    Location
    malaysia
    Posts
    14

    Detecting same value in 3 cells

    Need some help.

    Would like to detect same value in 3 cells. Can anyone come up with a solution to that.

    Q 16, R 16, S 16

    If there is a same value appearing in two of the three cells... it will acknowledge me.

  2. #2
    Forum Expert JBeaucaire's Avatar
    Join Date
    03-21-2004
    Location
    Bakersfield, CA
    MS-Off Ver
    2010, 2016, Office 365
    Posts
    33,492

    Re: Detecting same value in 3 cells

    Acknowledge to you how? You want them to light up/change color? Or a cell value in another column gives you some sort of warning like "Bad Match!"...? What do you want to happen?
    _________________
    Microsoft MVP 2010 - Excel
    Visit: Jerry Beaucaire's Excel Files & Macros

    If you've been given good help, use the icon below to give reputation feedback, it is appreciated.
    Always put your code between code tags. [CODE] your code here [/CODE]

    ?None of us is as good as all of us? - Ray Kroc
    ?Actually, I *am* a rocket scientist.? - JB (little ones count!)

  3. #3
    Registered User
    Join Date
    12-21-2008
    Location
    malaysia
    Posts
    14

    Re: Detecting same value in 3 cells

    Yes, the cell to change color

  4. #4
    Forum Moderator zbor's Avatar
    Join Date
    02-10-2009
    Location
    Croatia
    MS-Off Ver
    365 ProPlus
    Posts
    15,649

    Re: Detecting same value in 3 cells

    OK, so.. if Q 16 = R 16 = S 16 everything is OK.

    Do you need if any value is different to change color in all 3 cells or only in cell that is different from other two?


    If all 3 are different the collor will be changed in all 3...

  5. #5
    Registered User
    Join Date
    12-21-2008
    Location
    malaysia
    Posts
    14

    Re: Detecting same value in 3 cells

    thanks zbor for your reply.

    for example.

    Q16 = 1
    R 16 = 2
    S 16 = 1
    or

    Q16 = 1
    R 16 = 1
    S 16 = 2

    in these 3 cells as long as there's a duplicate found in 2 of the 3 cells, it will acknowledge me in a way. Pls help

  6. #6
    Forum Moderator zbor's Avatar
    Join Date
    02-10-2009
    Location
    Croatia
    MS-Off Ver
    365 ProPlus
    Posts
    15,649

    Re: Detecting same value in 3 cells

    New post...
    Last edited by zbor; 03-11-2009 at 05:25 AM.

  7. #7
    Forum Moderator zbor's Avatar
    Join Date
    02-10-2009
    Location
    Croatia
    MS-Off Ver
    365 ProPlus
    Posts
    15,649

    Re: Detecting same value in 3 cells

    Something like this?

    Try to change numbers in cells...

    Attachment 38598

    If all are equal green, otherwise red... (QRS)

    If all are equal green, one different red, all different all red (HIJ)
    Last edited by zbor; 03-27-2009 at 04:50 AM.

  8. #8
    Forum Expert JBeaucaire's Avatar
    Join Date
    03-21-2004
    Location
    Bakersfield, CA
    MS-Off Ver
    2010, 2016, Office 365
    Posts
    33,492

    Re: Detecting same value in 3 cells

    The Conditional Format is close, but needs a little tweaking:

    Q16: =AND(Q16<>0,Q16<>R16,Q16<>S16)
    R16: =AND(R16<>0,R16<>Q16,R16<>S16))
    S16: =AND(S16<>0,S16<>Q16,S16<>R16))

    Sample attached.
    Attached Files Attached Files
    Last edited by JBeaucaire; 03-11-2009 at 05:32 AM.

  9. #9
    Forum Moderator zbor's Avatar
    Join Date
    02-10-2009
    Location
    Croatia
    MS-Off Ver
    365 ProPlus
    Posts
    15,649

    Re: Detecting same value in 3 cells

    Why.. can't they all be 0=0=0

    Did you upload right document?
    Last edited by zbor; 03-11-2009 at 05:34 AM.

  10. #10
    Forum Expert JBeaucaire's Avatar
    Join Date
    03-21-2004
    Location
    Bakersfield, CA
    MS-Off Ver
    2010, 2016, Office 365
    Posts
    33,492

    Re: Detecting same value in 3 cells

    Misread the original post. Corrected above, text and workbook.

    He should have the idea by now...

  11. #11
    Registered User
    Join Date
    12-21-2008
    Location
    malaysia
    Posts
    14

    Re: Detecting same value in 3 cells

    Zbor, what did you do to it work like the one you posted?
    can you teach me?

  12. #12
    Forum Moderator zbor's Avatar
    Join Date
    02-10-2009
    Location
    Croatia
    MS-Off Ver
    365 ProPlus
    Posts
    15,649

    Re: Detecting same value in 3 cells

    It's all about conditional formating...

    I'll do step by step... Don't mind me for repeating things that you already know...

    In HIJ I used OR formula and colors...

    For deafult cell color of all 3 cells I used red Attachment 38700

    After that (again for all 3 cells) I used conditional formating...

    Conditional Format -> New rule -> Use a formula to determine wich cells to format:

    Now you need a formula: what do you want to do...

    In this case you want that: if that cell is same like some other cell it will become green... If not it will stay red...

    so..

    17 16 17 - green red green
    16 17 17 - red green green
    14 14 14 - green green green
    14 16 17 - red red red and so on...

    Attachment 38701

    For this case formula is:
    H cell: =OR(H19=I19; H19=J19)
    I cell: =OR(I19=H19;I19=J19)
    J cell: =OR(J19=H19;J19=I19)

    Comparing each cell with any other cell... (if there is more cell, let say 30 or 100, this would be hard to do, you would need other solution)...

    If you need all cells to become red or green principle is the same, you only need other formula:


    Q cell: =AND(Q16=R16;Q16=S16)
    R cell: =AND(Q16=R16;R16=S16)
    S cell: =AND(S16=R16;Q16=S16)

    Enjoy

    Edit: please put this thread as solved if you satisfied with solution
    Last edited by zbor; 03-27-2009 at 04:50 AM.

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1