+ Reply to Thread
Results 1 to 10 of 10

Countif problem

  1. #1
    Registered User
    Join Date
    05-08-2012
    Location
    Johannesburg
    MS-Off Ver
    Excel 2007
    Posts
    5

    Post Countif problem

    Hi Guys,

    I am stuck with a problem and have hit a brick wall. Will really appreciate some help on this.

    I have a data set with multiple store names in. I am trying to count the amount of stores that are in the data set.
    What has worked thus far is this count if function that I used that looks like this: =COUNTIF(CONSIGNEE,"*" & "Checkers" & "*") – Consignee is the column in which all the store names appear. However some data sets have multiple names in one line like: "Shoprite Checkers".

    Both these stores need to be counted as they are separate stores, but sometimes they the names are interchangeable and thus get typed in as one, but when they appear in the same line they get counted twice even though its one location.

    Is there a way to fix this?

  2. #2
    Forum Expert Bob Phillips's Avatar
    Join Date
    09-03-2005
    Location
    Wessex
    MS-Off Ver
    Office 2003, 2010, 2013, 2016, 365
    Posts
    3,284

    Re: Countif problem

    Why don't you use

    =COUNTIF(CONSIGNEE,"Checkers")

  3. #3
    Forum Expert dilipandey's Avatar
    Join Date
    12-05-2011
    Location
    Dubai, UAE
    MS-Off Ver
    1997 - 2016
    Posts
    8,191

    Re: Countif problem

    Hi Werner87,

    Welcome to the forum.

    So do you need to count the names having the word "checkers" in them...?
    Or, do you want to count the names, may be in a cell with spaces in between like... "abc def ghi checkers" or may be without checkers.. i.e., "abc xyz ddd" ?

    Upload a sample file or a list of those store names with the answer you are looking for.. thanks.

    Regards,
    DILIPandey

    <click on below 'star' if this helps>
    DILIPandey, Excel rMVP
    +919810929744 (India), +971528225509 (Dubai), [email protected]

  4. #4
    Registered User
    Join Date
    05-08-2012
    Location
    Johannesburg
    MS-Off Ver
    Excel 2007
    Posts
    5

    Re: Countif problem

    Hi Bob,

    The issue is I am trying to count the amount of stores that are in the data set that match the chain stores that we deliver to already. The goal is to only count certain store names that we make deliveries to and so I can determine the synergies between the data set and our own deliveries.
    The normal =COUNTIF(CONSIGNEE,"Checkers") doesn’t work as the store names are not always typed in the same way and are mostly surrounded by locations names or other parts of text strings. An example is: “SHOPRITE CECKERS MIDRAND DC - PRETORIA”.

  5. #5
    Registered User
    Join Date
    05-08-2012
    Location
    Johannesburg
    MS-Off Ver
    Excel 2007
    Posts
    5

    Re: Countif problem

    Hi DILIPandey,

    I am trying to count the names that are in cells with spaces in them. I uploaded an example of what I’m trying to do.

    Thanks
    Werner87
    Attached Files Attached Files

  6. #6
    Forum Expert Fotis1991's Avatar
    Join Date
    10-11-2011
    Location
    Athens(The homeland of the Democracy!). Greece
    MS-Off Ver
    Excel 1997!&2003 & 2007&2010
    Posts
    13,744

    Re: Countif problem

    Hi and welcome to the forum.

    This Array formula(CSE), gives results but i am not able to test these(Huge range). Pls, take a look.

    =SUM(LEN($D$2:$D$65000)-SUM(LEN(SUBSTITUTE($D$2:$D$65000;A2;"")))/LEN(A2))

    Change the semi colons to comma, if you have to do this..
    Regards

    Fotis.

    -This is my Greek whisper to Europe.

    --Remember, saying thanks only takes a second or two. Click the little star * below, to give some Rep if you think an answer deserves it.

    Advanced Excel Techniques: http://excelxor.com/

    --KISS(Keep it simple Stupid)

    --Bring them back.

    ---See about Acropolis of Athens.

    --Visit Greece.

  7. #7
    Registered User
    Join Date
    05-08-2012
    Location
    Johannesburg
    MS-Off Ver
    Excel 2007
    Posts
    5

    Re: Countif problem

    Hi Fotis,

    I tried your formula, however it returns a decimal answer were it is suppose to have a value of 0.

    Any other ideas?

    Regards
    Werner

  8. #8
    Forum Expert Fotis1991's Avatar
    Join Date
    10-11-2011
    Location
    Athens(The homeland of the Democracy!). Greece
    MS-Off Ver
    Excel 1997!&2003 & 2007&2010
    Posts
    13,744

    Re: Countif problem

    Hi

    Are the numbers in colomn B, the correct result??

    If NO, pls, give me an example..

  9. #9
    Registered User
    Join Date
    05-08-2012
    Location
    Johannesburg
    MS-Off Ver
    Excel 2007
    Posts
    5

    Re: Countif problem

    Hi,

    The numbers in column B are correct. The only issue is with the Shoprite store name and the Checkers store name as they are counted twice but is suppose to be counted as one for when they are in the same line.

    Werner

  10. #10
    Forum Guru
    Join Date
    05-24-2011
    Location
    India
    MS-Off Ver
    Office 2021
    Posts
    2,237

    Re: Countif problem

    Hi,

    In B2, then copy down.

    =SUMPRODUCT(ISNUMBER(SEARCH(" "&A2&" "," "&D$2:D$1445&" "))+0)

    Is that you wish to get?
    Regards,
    Haseeb Avarakkan

    __________________________________
    "Feedback is the breakfast of champions"

+ 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