+ Reply to Thread
Results 1 to 22 of 22

Formula for identifying equal values

  1. #1
    Registered User
    Join Date
    06-28-2013
    Location
    Wolverhampton
    MS-Off Ver
    Excel 2002
    Posts
    3

    Formula for identifying equal values

    Hi I am hoping you can help me with a formula for a friend, he basically has four specific cells and he needs them to become highlighted if all four show the same value, is this possible at all?

    Thanks in advance.

  2. #2
    Forum Expert Ace_XL's Avatar
    Join Date
    06-04-2012
    Location
    UAE
    MS-Off Ver
    2016
    Posts
    6,074

    Re: Formula for identifying equal values

    In Conditional Formatting use

    =COUNTIF($A$1:$D$1,$A$1)=4
    Life's a spreadsheet, Excel!
    Say thanks, Click *

  3. #3
    Banned User!
    Join Date
    10-14-2006
    Posts
    1,211

    Re: Formula for identifying equal values

    Conditional Formatting:

    =COUNTIF($A$2:$D$2,$A$2)=4

  4. #4
    Registered User
    Join Date
    06-28-2013
    Location
    Wolverhampton
    MS-Off Ver
    Excel 2002
    Posts
    3

    Re: Formula for identifying equal values

    Thanks for the help, he says:

    I have entered =countif($E$21;$E$24;$E$27;$E$30)=$I$20

    and it is saying I have entered too few arguments
    Any idea where he is going wrong?

  5. #5
    Valued Forum Contributor
    Join Date
    07-27-2012
    Location
    Dublin, Ireland
    MS-Off Ver
    Excel 2010
    Posts
    826

    Re: Formula for identifying equal values

    Why is he entering that? Has he tried the solutions provided by Ace & Teethless mama?
    Brendan.


    __________________________________________________________________________________________________
    Things to consider:

    1) You can thank any poster by clicking the * at the left of a helpful post.
    2) You can help to keep the forum tidy by marking your thread as "Solved", if it has been answered to your satisfaction.
    3) Help us to help you, by uploading a sample workbook, showing the type of data you're dealing with, and clearly indicating what the results should be.

  6. #6
    Registered User
    Join Date
    06-28-2013
    Location
    Wolverhampton
    MS-Off Ver
    Excel 2002
    Posts
    3

    Re: Formula for identifying equal values

    He is going to sign up and reply directly, saves me being a go between but thanks for your help everyone.
    Last edited by LeeAsh; 06-28-2013 at 10:38 AM.

  7. #7
    Registered User
    Join Date
    06-28-2013
    Location
    Den Haag
    MS-Off Ver
    Excel 2003
    Posts
    15

    Re: Formula for identifying equal values

    Hi Everyone

    I am Rob and Lee has been asking this question for me as he was someone who I reached out to for help because he is the man that can. But I seemed to have stumped him.
    I am working on an excel file where I wish to set a rule in the conditional formatting that will allow me to highlight four cells indicating that the data entered in them is the same. I only want it to highlight all of the 4 cells when the value is the same is this possible or not? I am not an excel wizard and I would really appreciate some help as I am a little bit stuck.

  8. #8
    Forum Expert Tony Valko's Avatar
    Join Date
    12-31-2011
    Location
    Pittsburgh
    MS-Off Ver
    2002, 2007:2013
    Posts
    18,890

    Re: Formula for identifying equal values

    Give us the addresses of the cells in question.

    If all 4 cells are empty they would all be equal but I suppose you wouldn't want them to be highlighted if/when that occurs?
    Biff
    Microsoft MVP Excel
    Keep It Simple Stupid

    Let's Go Pens. We Want The Cup.

  9. #9
    Forum Expert martindwilson's Avatar
    Join Date
    06-23-2007
    Location
    London,England
    MS-Off Ver
    office 97 ,2007
    Posts
    19,320

    Re: Formula for identifying equal values

    =countif($E$21;$E$24;$E$27;$E$30)=$I$20 you cant use countif with a dis-contiguous range
    =AND(E21=E24,E21=E27,E21=E30,E24=E27,E24=E30,E27=E30)
    Last edited by martindwilson; 06-28-2013 at 10:56 AM.
    "Unless otherwise stated all my comments are directed at OP"

    Mojito connoisseur and now happily retired
    where does code go ?
    look here
    how to insert code

    how to enter array formula

    why use -- in sumproduct
    recommended reading
    wiki Mojito

    how to say no convincingly

    most important thing you need
    Martin Wilson: SPV
    and RSMBC

  10. #10
    Valued Forum Contributor
    Join Date
    07-27-2012
    Location
    Dublin, Ireland
    MS-Off Ver
    Excel 2010
    Posts
    826

    Re: Formula for identifying equal values

    Hi rob, welcome to the forum. Have you tried either of the solutions already provided?


    EDIT: Good point regarding non-contiguous cells, Martin.

  11. #11
    Registered User
    Join Date
    06-28-2013
    Location
    Den Haag
    MS-Off Ver
    Excel 2003
    Posts
    15

    Re: Formula for identifying equal values

    Yeah I also want them to not be highlighted when they are blank but I have another conditional formating set to highlight them a seperate colour when they are empty and also I need them not to highlight when three of them, or two of them are the same.

    The cells I am using are E21 E24 E27 and E30.

    Am I asking the impossible?

  12. #12
    Registered User
    Join Date
    06-28-2013
    Location
    Den Haag
    MS-Off Ver
    Excel 2003
    Posts
    15

    Re: Formula for identifying equal values

    Excel.png This is my cell layout. I have highlighted the four cells that I need to highlight if they are all the same value. The red cell is where I have the text that will be filled in the field

  13. #13
    Forum Expert Tony Valko's Avatar
    Join Date
    12-31-2011
    Location
    Pittsburgh
    MS-Off Ver
    2002, 2007:2013
    Posts
    18,890

    Re: Formula for identifying equal values

    Try this...

    =AND(E21<>"",E21=E24,E24=E27,E27=E30)

  14. #14
    Registered User
    Join Date
    06-28-2013
    Location
    Den Haag
    MS-Off Ver
    Excel 2003
    Posts
    15

    Re: Formula for identifying equal values

    I am getting a 'formula contains error' message for all of these. I am pasting the solutions you give into the conditional formatting. Highlight cell rules, more rules, use formula. I am putting this in the right one?
    As I say I am very new at using these rules.

  15. #15
    Forum Expert martindwilson's Avatar
    Join Date
    06-23-2007
    Location
    London,England
    MS-Off Ver
    office 97 ,2007
    Posts
    19,320

    Re: Formula for identifying equal values

    use ; instead of ,
    =AND(E21<>"";E21=E24;E24=E27;E27=E30)

  16. #16
    Registered User
    Join Date
    06-28-2013
    Location
    Den Haag
    MS-Off Ver
    Excel 2003
    Posts
    15

    Re: Formula for identifying equal values

    Ive tried this and still no joy.

  17. #17
    Forum Expert Tony Valko's Avatar
    Join Date
    12-31-2011
    Location
    Pittsburgh
    MS-Off Ver
    2002, 2007:2013
    Posts
    18,890

    Re: Formula for identifying equal values

    Here's a small sample file that demonstrates this.

    RobWatson.xls

  18. #18
    Registered User
    Join Date
    06-28-2013
    Location
    Den Haag
    MS-Off Ver
    Excel 2003
    Posts
    15

    Re: Formula for identifying equal values

    Thanks Tony. I understand where I was going wrong. I was trying to add the formula to the four cells.

  19. #19
    Forum Expert Tony Valko's Avatar
    Join Date
    12-31-2011
    Location
    Pittsburgh
    MS-Off Ver
    2002, 2007:2013
    Posts
    18,890

    Re: Formula for identifying equal values

    Good deal. Thanks for the feedback!

  20. #20
    Registered User
    Join Date
    06-28-2013
    Location
    Den Haag
    MS-Off Ver
    Excel 2003
    Posts
    15

    Re: Formula for identifying equal values

    Hi everyone.

    Thanks for the help last week, I really appreciate it.

    I have another couple of questions regarding the same spreadsheet and the problems also if you know a good place for me to learn how to use the more complex formulas for excel I really would like to understand them, as the solution I still don't understand even though it works.

    In the same spreadsheet I would like to make a similar set of four cells highlight if three out of the four have the same values, is this possible to do using a similar formula?

  21. #21
    Forum Expert martindwilson's Avatar
    Join Date
    06-23-2007
    Location
    London,England
    MS-Off Ver
    office 97 ,2007
    Posts
    19,320

    Re: Formula for identifying equal values

    for 3
    =OR(AND(E21=E24,E24=E27),AND(E21=E27,E21=E30),AND(E24=E27,E24=E30),AND(E21=E24,E24=E30))
    if 3 ane blank and you dont want to include that
    =IF(COUNTA(E21,E24,E27,E30)<3,FALSE,OR(AND(E21=E24,E24=E27),AND(E21=E27,E21=E30),AND(E24=E27,E24=E30),AND(E21=E24,E24=E30)))
    Last edited by martindwilson; 07-01-2013 at 06:03 AM.

  22. #22
    Valued Forum Contributor
    Join Date
    07-27-2012
    Location
    Dublin, Ireland
    MS-Off Ver
    Excel 2010
    Posts
    826

    Re: Formula for identifying equal values

    @Rob,

    Quote Originally Posted by RobWatson View Post
    ... as the solution I still don't understand even though it works. ...
    Tony's solution:

    Quote Originally Posted by Tony Valko View Post
    =AND(E21<>"",E21=E24,E24=E27,E27=E30)
    basically says that for the formula to evaluate to TRUE, the following conditions must be met:

    E21<>"": E21 must not be blank (literally, E21 not equal to (<>) blank / an empty string (""))
    E21=E24: E21 must equal E24
    E24=E27: E24 must equal E27
    E27=E30: E27 must equal E30

    The "AND" at the start of the formula means that ALL of the conditions must be true.


    Therefore, logically, if E21 is equal to E24, and E24 is equal to E27, and E27 is equal to E30, then the 4 cells must be the same as each other. Does this help?

+ 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