+ Reply to Thread
Results 1 to 10 of 10

Count Values In Two Columns That Does NOT Match

  1. #1
    Registered User
    Join Date
    11-21-2013
    Location
    United States
    MS-Off Ver
    Excel 2013
    Posts
    99

    Count Values In Two Columns That Does NOT Match

    Hello,

    I would be very appreciative of Excel expert's help.

    I use SUMPRODUCT formula to count the values in two columns that do not match but it doesn't work: =SUMPRODUCT(--(DataTable!A2:A150<>""),--(DataTable!A2:A150='Pivot Table'!A2:A150)). For some reason this formula counts a total number of values on "Data Table spreadsheet. Both columns are located on two different spreadsheets. The sample of data is attached.

    SUMPRODUCT.xlsx

  2. #2
    Valued Forum Contributor Gatti's Avatar
    Join Date
    06-08-2015
    Location
    Brasil, São Paulo, Ribeirão Preto
    MS-Off Ver
    365
    Posts
    346

    Re: Count Values In Two Columns That Does NOT Match

    Hello

    Try this:

    Please Login or Register  to view this content.
    Don't forget to CTRL+SHIFT+Enter
    If I have solved your question, please mark the thread as [SOLVED],
    And consider adding reputation

    ?Simplicity is the ultimate sophistication? (Leonardo Da Vinci)

    Regards,
    F?bio Gatti

    https://www.youtube.com/pulodogatti
    https://www.linkedin.com/in/fabiocgatti/
    https://instagram.com/pulodogatti

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

    Re: Count Values In Two Columns That Does NOT Match

    Hang on..

    Are you wanting to count If
    Sheet1!A2 = DataTable!A2
    Sheet1!A3 = DataTable!A3
    Sheet1!A4 = DataTable!A4

    OR

    Sheet1!A1 = ANY Value in DataTable!$A$2:$A$150
    Sheet1!A2 = ANY Value in DataTable!$A$2:$A$150
    Sheet1!A3 = ANY Value in DataTable!$A$2:$A$150

    ??

  4. #4
    Forum Expert
    Join Date
    12-15-2009
    Location
    Chicago, IL
    MS-Off Ver
    Microsoft Office 365
    Posts
    3,177

    Re: Count Values In Two Columns That Does NOT Match

    Give this array formula a try. Enter with Ctrl + Shift + Enter keys together

    =SUM(IF(IFERROR(MATCH('Pivot Table'!$A$2:$A$65,DataTable!$A$2:$A$145,0),0)>0,1,0))
    Attached Files Attached Files

  5. #5
    Registered User
    Join Date
    11-21-2013
    Location
    United States
    MS-Off Ver
    Excel 2013
    Posts
    99

    Re: Count Values In Two Columns That Does NOT Match

    Hi guys,

    Thank you so much for your quick replies! Unfortunately, neither formula works. I attached the spreadsheet with the two of your formulas applied - entered as an array.

    Pivot Table sheet contains 64 records which all are also listed in Data Table sheet. So the formula should return 80 records that are not matched.


    SUM(IF(IFERROR(MATCH('Pivot Table'!$A$2:$A$65,DataTable!$A$2:$A$145,0),0)>0,1,0)) formula returns 64 records

    SUM(($A$2:$A$150<>"")*1,(DataTable!$A$2:$A$150=$A$2:$A$150)*1) formula returns 69 records.

    I need to return a number of records that are NOT matched in these two tables. Do you have any suggestions as to how the formula needs to be modified?

    SUMPRODUCT.xlsx

  6. #6
    Forum Expert
    Join Date
    12-15-2009
    Location
    Chicago, IL
    MS-Off Ver
    Microsoft Office 365
    Posts
    3,177

    Re: Count Values In Two Columns That Does NOT Match

    Give this formula a try then. Enter with Ctrl + Shift + Enter keys together
    =COUNTA(DataTable!A:A)-SUM(IF(IFERROR(MATCH('Pivot Table'!$A$2:$A$65,DataTable!$A$2:$A$145,0),0)>0,1,0))-1

  7. #7
    Registered User
    Join Date
    11-21-2013
    Location
    United States
    MS-Off Ver
    Excel 2013
    Posts
    99

    Re: Count Values In Two Columns That Does NOT Match

    Hi JieJenn,

    This is great! The formula works and correctly return the number of not matched records, which in this case is 80.

    However, the formula doesn't account for the blank cells. Both tables on the Data Table tab and Pivot Table tab will have a different number of rows each week, which could range from 10000 to 50000.

    Could you please update the formula to account empty cells if I set up this maximum range in the formula?

    I tremendously appreciate your time and effort to help me!!!

  8. #8
    Registered User
    Join Date
    11-21-2013
    Location
    United States
    MS-Off Ver
    Excel 2013
    Posts
    99

    Re: Count Values In Two Columns That Does NOT Match

    Hi Jonmo1,

    I want to count if:

    Sheet1!A1 = ANY Value in DataTable!$A$2:$A$150
    Sheet1!A2 = ANY Value in DataTable!$A$2:$A$150
    Sheet1!A3 = ANY Value in DataTable!$A$2:$A$150


    and I need to account for blank cells because every week the pivot table and a data table will have a different number of rows. So I was thinking to set a maximum range, lets say 50000 rows.

    Can you help me with this?

    Thank you!

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

    Re: Count Values In Two Columns That Does NOT Match

    Try this on the pivot table tab.

    =SUMPRODUCT(--(ISNUMBER(MATCH(A2:A65,DataTable!A2:A145,0))))


    I understand the need to accomodate fluxuating table sizes.
    But try to keep those row #s as low as possible, go with the 10% rule
    Come up with a reasonable number where you can say "certainly my data will never be more than xxx rows"
    And add 10% to that number.

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

    Re: Count Values In Two Columns That Does NOT Match

    Maybe we're confused on the goal.
    The title says count those that DO NOT Match, but the formlua you attempted appears to count the ones that DO Match.

    Then I asked for a clarification, and you said
    Quote Originally Posted by Neyme View Post
    Hi Jonmo1,

    I want to count if:

    Sheet1!A1 = ANY Value in DataTable!$A$2:$A$150
    Sheet1!A2 = ANY Value in DataTable!$A$2:$A$150
    Sheet1!A3 = ANY Value in DataTable!$A$2:$A$150
    That reads that you want to count the ones that DO match.


    If you're wanting to count the ones that DO NOT match, try

    =SUMPRODUCT(--(A2:A65<>""),--(ISNA(MATCH(A2:A65,DataTable!A2:A145,0))))

+ 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. Look up values in 2 adjacent columns. Return values in 3 columns if match.
    By Gssoc777 in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 11-04-2015, 12:28 PM
  2. [SOLVED] Formula count if values match in two columns
    By MIGARDEIN in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 03-13-2015, 04:15 PM
  3. [SOLVED] Distribute values in columns based on match between two other columns
    By hydrgal in forum Excel Formulas & Functions
    Replies: 6
    Last Post: 03-15-2013, 04:07 AM
  4. Match Columns in 2 Worksheets, return only changed values of other columns
    By cheynooki in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 02-17-2011, 01:19 PM
  5. Replies: 5
    Last Post: 10-11-2008, 04:01 PM
  6. Count if two columns match different criteria
    By Curt D. in forum Excel Formulas & Functions
    Replies: 4
    Last Post: 05-02-2006, 01:35 AM
  7. [SOLVED] If two columns match then count one. How? Tried countif and sum .
    By IMC Medrec in forum Excel Formulas & Functions
    Replies: 1
    Last Post: 02-14-2005, 09:06 AM

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