+ Reply to Thread
Results 1 to 8 of 8

Countif & Contains?

  1. #1
    Valued Forum Contributor
    Join Date
    07-16-2007
    Location
    GA
    MS-Off Ver
    Office 365 - Version 2403
    Posts
    1,054

    Question Countif & Contains?

    Hi,

    I have a series of phone numbers & I'm trying to determine the number of times a particular area was called

    864384XXXX
    864316XXXX
    864288XXXX
    864288XXXX
    864232XXXX
    864384XXXX
    864384XXXX

    I thought I could use a formula like this: =COUNTIF($E$47:$E$322,"*864*")

    (Notice the ' * ')

    Where in this column, if the number contained an '864' number, it would count it.

    What's wront with this forumula or what is the correct formula?

    Thanks
    MyCon
    -- Using Latest Version of Excel

  2. #2
    Forum Expert teylyn's Avatar
    Join Date
    10-28-2008
    Location
    New Zealand
    MS-Off Ver
    Excel 365 Insider Fast
    Posts
    11,372

    Re: Countif & Contains?

    Hi, I don't think countif can use wildcards. You could do something like

    =SUMPRODUCT(--(LEFT(A1:A7,3)="864"))

    hth

  3. #3
    Valued Forum Contributor
    Join Date
    07-16-2007
    Location
    GA
    MS-Off Ver
    Office 365 - Version 2403
    Posts
    1,054

    Re: Countif & Contains?

    Hi Teylyn,

    Thanks for the formula - that worked! Could've sworn though that there was some symbol that worked to act as wildcard in a Countif forumula

    Now, I have a similar question, which is the basically the same thing - Find '864' #, but now, total up the minutes.

    I tried using this: =SUMIF($E$47:$E$322,"864",$F$47:$F$322), but again, it can't find the '864'

    Please advise & thanks again...

  4. #4
    Forum Expert teylyn's Avatar
    Join Date
    10-28-2008
    Location
    New Zealand
    MS-Off Ver
    Excel 365 Insider Fast
    Posts
    11,372

    Re: Countif & Contains?

    try this on your pianola:

    =SUMPRODUCT(--(LEFT($E$47:$E$322,3)="864"),$F$47:$F$322)

    hth

  5. #5
    Forum Guru
    Join Date
    03-02-2006
    Location
    Los Angeles, Ca
    MS-Off Ver
    WinXP/MSO2007;Win10/MSO2016
    Posts
    12,612

    Re: Countif & Contains?

    Must the entire number be in one column or can they be split into area code, prefix and number columns?
    Ben Van Johnson

  6. #6
    Valued Forum Contributor
    Join Date
    07-16-2007
    Location
    GA
    MS-Off Ver
    Office 365 - Version 2403
    Posts
    1,054

    Re: Countif & Contains?

    Hi Again Teylyn,

    Your 2nd formula worked great to!! As for protonLeah's question - No, I cannot seperate number into its own column. I'm trying to track mobile calls & copying & pasting from online phone bill. For the most part, I'm tracking my phone calls & a few other things.

    Thanks

  7. #7
    Forum Guru DonkeyOte's Avatar
    Join Date
    10-22-2008
    Location
    Northumberland, UK
    MS-Off Ver
    O365
    Posts
    21,531

    Re: Countif & Contains?

    Quote Originally Posted by teylyn View Post
    Hi, I don't think countif can use wildcards.
    Not so, this is one of the great advantages of SUMIF/COUNTIF etc.... so the original formula "should" work:

    Quote Originally Posted by mycon73
    =COUNTIF($E$47:$E$322,"*864*")
    With the aforementioned data set the above would return 7.

    If you wish to find only numbers commencing with 864 (implied by Teylyn's SUMPRODUCT which you say works) then change the code to:

    Please Login or Register  to view this content.
    ie remove the first * - this stipulates that the string must start with 864 - the second * stipulates that what appears thereafter is of no consequence and can be ignored.


    The SUMIF utilising the same wildcard approach should answer your 2nd question.
    Last edited by DonkeyOte; 01-17-2010 at 04:38 AM. Reason: wrong tags

  8. #8
    Forum Expert teylyn's Avatar
    Join Date
    10-28-2008
    Location
    New Zealand
    MS-Off Ver
    Excel 365 Insider Fast
    Posts
    11,372

    Re: Countif & Contains?

    I stand corrected! Shows that I need to study wildcards some more. Thanks for the enlightenment, DO!!

+ 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