+ Reply to Thread
Results 1 to 7 of 7

'All cells equal' check

  1. #1
    Registered User
    Join Date
    04-03-2006
    Posts
    24

    'All cells equal' check

    Hi All,

    Is it possible to write a formula that checks a range of cells all hold the same value?

    i.e. if B1-B10 all = 'True'
    then B11 =True,
    else B11=False

    in the above example I would need all ten cells (b1-B10) with True to return a 'True' response

    I posted a simialr question earlier, but it wasn't very clear.

    Thanks for your time.
    Last edited by steev_jd; 07-05-2010 at 10:59 AM.

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

    Re: 'All cells equal' check

    Solmething like this:

    =IF(COUNTIF(B1:B10, B1)=COUNTA(B1:B10), TRUE, FALSE)

  3. #3
    Registered User
    Join Date
    04-03-2006
    Posts
    24

    Re: 'All cells equal' check

    Hi - thanks but this doesn't seem to work. It just returns true no matter how I jumble up the values.

    To give more detail, I need it to check
    if all cells = P,
    return true
    else return false.

    Please note B1 may not hold 'P',

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

    Re: 'All cells equal' check

    Then this but only for 10 cells

    =IF(COUNTIF(B1:B10, B1)=10, TRUE, FALSE)

    or

    =IF(COUNTIF(B1:B10, "P")=10, TRUE, FALSE)

  5. #5
    Forum Expert NBVC's Avatar
    Join Date
    12-06-2006
    Location
    Mississauga, CANADA
    MS-Off Ver
    2003:2010
    Posts
    34,898

    Re: 'All cells equal' check

    Try perhaps:

    =SUMPRODUCT((B1:B10<>"")/COUNTIF(B1:B10,B1:B10&""))=1

    this will return TRUE if all values are the same in B1:B10 (doesn't matter the value).

    If you have blanks within the range and want to return False if any are blank.... then

    =AND(COUNTBLANK(B1:B10)=0,SUMPRODUCT((B1:B10<>"")/COUNTIF(B1:B10,B1:B10&""))=1)
    Last edited by NBVC; 07-05-2010 at 11:02 AM. Reason: Missed an equal sign, for clarity
    Where there is a will there are many ways.

    If you are happy with the results, please add to the contributor's reputation by clicking the reputation icon (star icon) below left corner

    Please also mark the thread as Solved once it is solved. Check the FAQ's to see how.

  6. #6
    Registered User
    Join Date
    04-03-2006
    Posts
    24

    Re: 'All cells equal' check

    Excellent guys, thanks very much - this has worked.

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

    Re: 'All cells equal' check

    =frequency(b1:b10,b1:b10)=10 oops ony works for numbers!
    "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

+ 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