+ Reply to Thread
Results 1 to 5 of 5

Can excel differentiate related numbers

  1. #1
    Forum Contributor
    Join Date
    11-13-2010
    Location
    Warren, Michigan
    MS-Off Ver
    Excel 2008 for Mac
    Posts
    307

    Can excel differentiate related numbers

    Is there any coding, which will NOT differentiate between numbers, but match and group each 2-digit number, let's say: 12 and 21 because both have a 1 and 2?

    Example:

    A1: 12
    A2: 36
    A3: 45
    A4: 11
    A5: 09
    A6: 21
    A7: 12

    This column is for my "match" number (12 & 21)

    C:1 12


    This column is for a "countif" function???

    D1: 3

    The answer for be "3" (A1, A6, A7).
    Last edited by khank; 03-10-2011 at 11:20 AM.

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

    Re: Can excel differentiate related numbers

    For the second formula (countif) you can use:

    =COUNTIFS(A1:A7,"*1*",A1:A7,"*2*")

    or

    =COUNTIFS(A1:A7,"*"&X1&"*",A1:A7,"*"&X2&"*")

    if X1 and X2 contain the 2 lookup digits.

    I don't get Part 1.. you have a result in C1 of 12.. is that it? If so, why?
    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.

  3. #3
    Forum Contributor
    Join Date
    11-13-2010
    Location
    Warren, Michigan
    MS-Off Ver
    Excel 2008 for Mac
    Posts
    307

    Re: Can excel differentiate related numbers

    Quote Originally Posted by NBVC View Post
    For the second formula (countif) you can use:

    =COUNTIFS(A1:A7,"*1*",A1:A7,"*2*")

    or

    =COUNTIFS(A1:A7,"*"&X1&"*",A1:A7,"*"&X2&"*")

    if X1 and X2 contain the 2 lookup digits.

    I don't get Part 1.. you have a result in C1 of 12.. is that it? If so, why?

    Sorry I didn't explain myself clearly. C1:12 is the 2-digit sequence I'm looking either 12 or 21.

    I tried both without any luck. Both came up with "0". ???? Couldn't I use the "countifs" function with "12" and "21"?

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

    Re: Can excel differentiate related numbers

    Quote Originally Posted by khank View Post
    Couldn't I use the "countifs" function with "12" and "21"?
    You could do it easily with:

    =Countif(A1:A7,C1)+Countif(A1:A7,C2)

    if you have C1 = 12 and C2 = 21

    or if you want to have only C1 =12, then

    =COUNTIFS(A1:A7,"*"&LEFT(C1)&"*",A1:A7,"*"&RIGHT(C1)&"*")

  5. #5
    Forum Contributor
    Join Date
    11-13-2010
    Location
    Warren, Michigan
    MS-Off Ver
    Excel 2008 for Mac
    Posts
    307

    Re: Can excel differentiate related numbers

    The simplest is the always the best (=COUNTIF(A1:A7,"12")+COUNTIF(A1:A7,"21") works.

    Thanks.

+ 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