+ Reply to Thread
Results 1 to 3 of 3

Count the number of textual instances in a cell

  1. #1
    Registered User
    Join Date
    05-03-2013
    Location
    London
    MS-Off Ver
    Excel 2016
    Posts
    56

    Count the number of textual instances in a cell

    Hi

    Apologies if this question is in wrong forum as my requirement is both a function and a charting question. I have a number of rows on a worksheet and 3 columns (well 3 for the purpose of this question anyway). Column A is a location code (always single value and unique) , Column B is the customers of that location and Column C the suppliers. Column B and C both contain variable values including blank, single value or multiple values seperated by a comma.

    I have attached the data, and my end requirement is produce bar charts showing the number of locations with 1-5 Customers, 6-10 Customers, 11-15 Customers, 16 or more Customers and the same for suppliers ie 2 bar charts.

    Can you advise how I produce this ie how to do I know how many values are in a cell if they are text seperated by comma and then I can probably go on to generate the chart myself, but if my requirement is clear I would really appreciate help in getting from A-Z

    Thanks so much in advance
    Darren
    Attached Files Attached Files

  2. #2
    Forum Guru benishiryo's Avatar
    Join Date
    03-25-2011
    Location
    Singapore
    MS-Off Ver
    Excel 2013
    Posts
    5,147

    Re: Count the number of textual instances in a cell

    hi Darren. it'll be good to manually key some answers you are hoping to see, so that we know we are on the right track. if i'm not wrong, for counting customers, you can use:
    =IF(B2="",0,LEN(B2)-LEN(SUBSTITUTE(B2,",",""))+1)

    if you want to categorise them, then put these values somewhere say in J1:K4:
    1 1-5 Customers
    6 6-10 Customers
    11 11-15 Customers
    16 16 or more Customers

    then:
    =LOOKUP(IF(B2="",0,LEN(B2)-LEN(SUBSTITUTE(B2,",",""))+1),$J$1:$J$4,$K$1:$K$4)

    or if you wanna hard key them:
    Formula: copy to clipboard
    Please Login or Register  to view this content.

    Thanks, if you have clicked on the * and added our rep.

    If you're satisfied with the answer, click Thread Tools above your first post, select "Mark your thread as Solved".

    "Contentment is not the fulfillment of what you want, but the realization of what you already have."


    Tips & Tutorials I Compiled | How to Get Quick & Good Answers

  3. #3
    Registered User
    Join Date
    05-03-2013
    Location
    London
    MS-Off Ver
    Excel 2016
    Posts
    56

    Re: Count the number of textual instances in a cell

    Amazing, the formula worked to count the text entries so I now have 2 new colums (C and E) which count B and D and this has worked a charm, I can now see how many customers or suppliers a location has in a numerical value so thanks so much.

    I dont actually understand what you are saying about grouping them??? Sorry but thats really confusing for me as Im not sure if I need to manually enter something first or amend the look up each time?

    Worst case I will simply use the filter to work out how many rows fall into each category....

    Thanks again

+ 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