+ Reply to Thread
Results 1 to 4 of 4

How do I count number of values in row2 that doesn't exist in row1?

  1. #1
    Registered User
    Join Date
    08-15-2013
    Location
    USA
    MS-Off Ver
    Excel 2010
    Posts
    77

    Question How do I count number of values in row2 that doesn't exist in row1?

    I have two rows with values and blanks at the end (but I don't know how many blanks). For example,

    Row1: A C E G * * *
    Row2: H A C F I * * * *

    * is blank
    The values could be either text or numbers (but not both at the same time).
    Each individual row has unique values (no duplicate values in each row).

    1. I would like to know how many values there are in Row2 that doesn't exist in Row1, ignoring the blanks. In the example above, there are 3 values in Row2 that doesn't exist in Row1 (H, F, I).

    2. Alternatively, I would like to know how many of the values in Row1 also exist in Row2 (this is actually the final result that I need and it can easily be calculated from # of values in Row2 - result above = 5-3=2 ).

    Could someone propose a formula for this?
    TIA!
    Last edited by viking2; 08-26-2013 at 10:35 PM.

  2. #2
    Valued Forum Contributor
    Join Date
    02-08-2012
    Location
    Newcastle, Australia
    MS-Off Ver
    Excel 2007 and Excel 2010
    Posts
    1,429

    Re: How do I count number of values in row2 that doesn't exist in row1?

    Hi,

    Try this array formula in any cell:
    Formula: copy to clipboard
    Please Login or Register  to view this content.
    To enter an array formula, you need to use Ctrl + Shift + Enter as opposed to just Enter. You will also need to adjust the size and position of the ranges to match the number of columns that is appropriate to your actual data.

    This formula will give you the answer to number 2 (i.e. the number of values in Row 1 that appear in Row 2).

    I hope this helps

  3. #3
    Registered User
    Join Date
    08-15-2013
    Location
    USA
    MS-Off Ver
    Excel 2010
    Posts
    77

    Re: How do I count number of values in row2 that doesn't exist in row1?

    Thanks! It seems to work so far.
    Now I just need to try to figure out how this formula actually works
    e.g. what does SUM (--()) do?

  4. #4
    Valued Forum Contributor
    Join Date
    02-08-2012
    Location
    Newcastle, Australia
    MS-Off Ver
    Excel 2007 and Excel 2010
    Posts
    1,429

    Re: How do I count number of values in row2 that doesn't exist in row1?

    Hi,

    The array in the middle of this formula is actually an array of TRUE/FALSE values. The "--" forces Excel to convert a TRUE to a 1 and a FALSE to a 0. The formula in the middle itself will return a TRUE if the value from Row 1 is found in Row 2, and FALSE otherwise. So then hopefully you can see that the SUM part now is simply adding up the number of TRUE values returned, or the number of occurrences that a value from Row 1 was found in Row 2.

    Hope this helps

    Also, if this works for you, please don't forget to mark this thread as solved and please click on the * next to my post to say thanks

+ 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. [SOLVED] Count number in row if another number exist
    By Reykjavik in forum Excel Formulas & Functions
    Replies: 7
    Last Post: 07-04-2013, 04:16 PM
  2. Replies: 3
    Last Post: 09-22-2012, 01:11 AM
  3. Replies: 6
    Last Post: 08-22-2012, 07:53 AM
  4. VB Code is working for row1; how to apply to row2?
    By moike in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 08-17-2006, 02:50 PM
  5. [SOLVED] Copy Worksheet to a new Workbook creating if it doesn't exist and add more Worksheets if it does exist
    By pete.bastin@btopenworld.com in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 06-18-2006, 01:10 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