+ Reply to Thread
Results 1 to 4 of 4

Count if: Compare 2 ranges and count where cells in same row differ

  1. #1
    Registered User
    Join Date
    11-25-2008
    Location
    washington
    Posts
    24

    Count if: Compare 2 ranges and count where cells in same row differ

    Column A has current building, column b has future building. Would like to count the number of changes without adding a separate column with an if statement.
    Attached Files Attached Files

  2. #2
    Forum Guru Jonmo1's Avatar
    Join Date
    03-08-2013
    Location
    Bryan, TX
    MS-Off Ver
    Excel 2010
    Posts
    9,763

    Re: Count if: Compare 2 ranges and count where cells in same row differ

    Try

    =SUMPRODUCT(--(A2:A12<>B2:B12))

  3. #3
    Registered User
    Join Date
    11-25-2008
    Location
    washington
    Posts
    24

    Re: Count if: Compare 2 ranges and count where cells in same row differ

    thanks. that worked. can you explain the "--" what that does?

  4. #4
    Forum Guru Jonmo1's Avatar
    Join Date
    03-08-2013
    Location
    Bryan, TX
    MS-Off Ver
    Excel 2010
    Posts
    9,763

    Re: Count if: Compare 2 ranges and count where cells in same row differ

    You're welcome.

    (A2:A12<>B2:B12) in sumproduct is creating an array of TRUE or FALSE values
    The -- converts True/False to 1/0
    True=1, False=0
    it then adds them up.

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. Replies: 6
    Last Post: 11-11-2012, 12:40 AM
  2. [SOLVED] Compare a range with previous ranges and count matching numbers
    By sans in forum Excel General
    Replies: 29
    Last Post: 05-01-2012, 09:33 AM
  3. Replies: 26
    Last Post: 11-21-2011, 01:09 PM
  4. Compare Rows in 2 columns and count those that differ
    By Tim3057 in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 03-15-2007, 08:58 AM
  5. HOW DO I COMPARE TWO SHEETS AND IDENTIFY WHICH CELLS DIFFER
    By STEVE THE PARTS GUY in forum Excel General
    Replies: 1
    Last Post: 03-02-2006, 03:20 PM

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