+ Reply to Thread
Results 1 to 3 of 3

Count the first occurrence of a substring

  1. #1
    Forum Contributor
    Join Date
    07-18-2012
    Location
    New York
    MS-Off Ver
    2010
    Posts
    146

    Count the first occurrence of a substring

    Hello,

    I'm trying to add a column to a table to use for a sum of the unique items in a pivot table.
    I have seen a couple of formulas that will return a 1 for the first cell and 0 for all others that match, one such formula is

    Please Login or Register  to view this content.
    I need to take this a step further and include a mid formula so that I can have the formula look for specific text within the cell.
    One issue that I'm trying to solve for is that my data is a list of the previous day's emails and the text field I'm looking at is the subject line.
    If I have multiple emails with the same subject I want it to be able to ignore any RE: or FW:.
    I've been playing around and have what I think it should be

    Please Login or Register  to view this content.
    but it doesn't return consistent results. Do I need to have a separate column to parse out the substring first and then use the countif on that?

    Thank you in advance.

    Tristan

  2. #2
    Forum Guru teylyn's Avatar
    Join Date
    10-28-2008
    Location
    New Zealand
    MS-Off Ver
    Win 2010-2016
    Posts
    11,184

    Re: Count the first occurrence of a substring

    Hello,

    you can use Countif with a wildcard.

    =(COUNTIF($A$1:$A5,"*your substring*")=1)+0

  3. #3
    Forum Contributor
    Join Date
    07-18-2012
    Location
    New York
    MS-Off Ver
    2010
    Posts
    146

    Re: Count the first occurrence of a substring

    Quote Originally Posted by teylyn View Post
    Hello,

    you can use Countif with a wildcard.

    =(COUNTIF($A$1:$A5,"*your substring*")=1)+0
    Yes but the substring isn't consistent for every row.

    Until someone has a better solution I basically added a helper column to create my substring and then the countif is referencing the helper column.

    Thank you.

+ 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