+ Reply to Thread
Results 1 to 5 of 5

Need to count occurrences of a text + increasing number on the same cell

  1. #1
    Registered User
    Join Date
    05-15-2015
    Location
    Ontario, Canada
    MS-Off Ver
    Standard 2010
    Posts
    2

    Need to count occurrences of a text + increasing number on the same cell

    Hi,

    I am trying to calculate the number of times the same character appears with a number on the same cell.

    For eg: If Cell A1 contains the following string of character: Y1, Y24, Y19, Y23, Y1, Y17
    I need to count the number of times Y1 appears (and Y17 & Y19).

    Using the =LEN(A1)-LEN(SUBSTITUTE(A1,"Y1","")) counts this as 4 occurrences (includes Y17 & Y19).
    Is there a way we can check if there is another number following Y1 before it counts it as 1?

    PS: I am new on this forum and apologize beforehand if this question has already been answered.
    Your help in this matter is greatly appreciated.

  2. #2
    Forum Moderator Glenn Kennedy's Avatar
    Join Date
    07-08-2012
    Location
    Digital Nomad... occasionally based in Ireland.
    MS-Off Ver
    O365 (PC) V 2403
    Posts
    44,064

    Re: Need to count occurrences of a text + increasing number on the same cell

    If the commas are there you could try
    =LEN(A1)-LEN(SUBSTITUTE(A1,"Y1,",""))
    Glenn




    None of us get paid for helping you... we do this for fun. So DON'T FORGET to say "Thank You" to all who have freely given some of their time to help YOU.

    Temporary addition of accented to illustrate ongoing problem to the TT: L? fh?ile P?draig sona dhaoibh

  3. #3
    Forum Moderator Glenn Kennedy's Avatar
    Join Date
    07-08-2012
    Location
    Digital Nomad... occasionally based in Ireland.
    MS-Off Ver
    O365 (PC) V 2403
    Posts
    44,064

    Re: Need to count occurrences of a text + increasing number on the same cell

    ...assuming that it's the number of times that Y1 appears, that you're trying to count

  4. #4
    Registered User
    Join Date
    05-15-2015
    Location
    Ontario, Canada
    MS-Off Ver
    Standard 2010
    Posts
    2

    Re: Need to count occurrences of a text + increasing number on the same cell

    Thanks Glenn for your quick response.

    It worked like a charm after making some adjustments

    Thanks again for your help.
    Last edited by Valco; 05-16-2015 at 12:03 PM.

  5. #5
    Forum Moderator Glenn Kennedy's Avatar
    Join Date
    07-08-2012
    Location
    Digital Nomad... occasionally based in Ireland.
    MS-Off Ver
    O365 (PC) V 2403
    Posts
    44,064

    Re: Need to count occurrences of a text + increasing number on the same cell

    Thanks for the Reputation that you have added. It's much appreciated. If that takes care of your original question, please select Thread Tools from the menu link above and mark this thread as SOLVED.

+ 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 of occurrences but if there are consecutive matches count them as one
    By michaljireht in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 11-26-2013, 08:26 PM
  2. [SOLVED] Count number of occurrences for a number of ranges from a find loop
    By ANDREWA in forum Excel Programming / VBA / Macros
    Replies: 12
    Last Post: 08-23-2012, 07:53 PM
  3. Formula to Count the Number of Occurrences of a Text String in a Range
    By poug1903 in forum Excel Programming / VBA / Macros
    Replies: 7
    Last Post: 11-10-2011, 06:49 AM
  4. Replies: 1
    Last Post: 09-18-2009, 04:15 PM
  5. [SOLVED] Count number of occurrences
    By MarkM in forum Excel General
    Replies: 1
    Last Post: 07-27-2006, 05:15 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