+ Reply to Thread
Results 1 to 8 of 8

CountIF?

Hybrid View

  1. #1
    Registered User
    Join Date
    10-20-2008
    Location
    Ohio
    Posts
    2

    CountIF?

    I would like to analyze a list of numbers and be able to display how many listings have occured since a number appeared before. In other words : the string 10,15,24,18,19,15 : Looking at 15 would display the number 4. Any ideas?

  2. #2
    Forum Guru
    Join Date
    08-05-2004
    Location
    NJ
    MS-Off Ver
    365
    Posts
    13,582
    Are these numbers in a single cell or in a row or column?
    ChemistB
    My 2?

    substitute commas with semi-colons if your region settings requires
    Don't forget to mark threads as "Solved" (Edit First post>Advanced>Change Prefix)
    If I helped, Don't forget to add to my reputation (click on the little star at bottom of this post)

    Forum Rules: How to use code tags, mark a thread solved, and keep yourself out of trouble

  3. #3
    Registered User
    Join Date
    10-20-2008
    Location
    Ohio
    Posts
    2
    I have the numbers are listed in a column.

  4. #4
    Forum Expert NBVC's Avatar
    Join Date
    12-06-2006
    Location
    Mississauga, CANADA
    MS-Off Ver
    2003:2010
    Posts
    34,898
    Quote Originally Posted by amabomber View Post
    I have the numbers are listed in a column.
    My formula assumes that your numbers are listed in a column (A1:A6)

    Just adjust that range to suit your actual range of numbers.

    Also, change D1 to the cell reference containing the number you want to check (e.g. 15 per your sample).
    Where there is a will there are many ways.

    If you are happy with the results, please add to the contributor's reputation by clicking the reputation icon (star icon) below left corner

    Please also mark the thread as Solved once it is solved. Check the FAQ's to see how.

  5. #5
    Forum Guru
    Join Date
    08-05-2004
    Location
    NJ
    MS-Off Ver
    365
    Posts
    13,582
    Hi NBVC,
    I think he/she's looking at a running formula down column B which looks to the left and says when that last appeared. I modified your formula a bit to see if it worked for that and works when there are only duplicates but not for triplicates (I added another 15 and the second 15 gives an incorrect value of 7 but the 3rd one is right at 3). Take a look and see if you can modify the formula.
    Attached Files Attached Files

  6. #6
    Forum Expert NBVC's Avatar
    Join Date
    12-06-2006
    Location
    Mississauga, CANADA
    MS-Off Ver
    2003:2010
    Posts
    34,898
    One way:

    =MATCH(2,(1/(A1:A6=D1)))-MATCH(2,(1/(A1:INDEX(A:A,MATCH(2,(1/(A1:A6=D1)))-1)=D1)))

    where A1:A6 is the whole range of numbers and D1 contains the number to evaluate (e.g. 15)

    Note: The formula must be confirmed with CTRL+SHIFT+ENTER not just ENTER. You will see { } brackets appear around the formula.

  7. #7
    Forum Expert NBVC's Avatar
    Join Date
    12-06-2006
    Location
    Mississauga, CANADA
    MS-Off Ver
    2003:2010
    Posts
    34,898
    How about in B2, CSE confirmed and copied down?

    =IF(COUNTIF($A$2:A2,A2)=1,0,ROW()-MATCH(2,(1/($A$2:INDEX(A:A,ROW()-1)=A2)))-1)

  8. #8
    Forum Guru
    Join Date
    08-05-2004
    Location
    NJ
    MS-Off Ver
    365
    Posts
    13,582
    As our friends across the pond would say, "Works a treat." Nice one, NBVC.

+ 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. countif with two conditions
    By jmz82 in forum Excel Formulas & Functions
    Replies: 7
    Last Post: 12-04-2007, 05:36 PM
  2. LOOKUP and returning row for COUNTIF
    By Fuddy Duddy in forum Excel Formulas & Functions
    Replies: 6
    Last Post: 11-17-2007, 12:58 PM
  3. COUNTIF Function using more than one criterion
    By ary in forum Excel Formulas & Functions
    Replies: 5
    Last Post: 07-19-2007, 05:14 AM
  4. Pivot Table Formula-- COUNTIF?
    By svaiskau in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 07-06-2007, 10:23 AM
  5. newbie's countif
    By lingyai in forum Excel Formulas & Functions
    Replies: 1
    Last Post: 09-19-2006, 03:03 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