+ Reply to Thread
Results 1 to 4 of 4

How to count # of items followed by a specific value in a column?

  1. #1
    Registered User
    Join Date
    07-16-2011
    Location
    Boston
    MS-Off Ver
    Excel 2003
    Posts
    12

    How to count # of items followed by a specific value in a column?

    I have a long column of numbers. I want to know how many of those numbers are followed by an "8" in the next item (next row). What's the best way to compute that?

  2. #2
    Forum Expert
    Join Date
    03-23-2004
    Location
    London, England
    MS-Off Ver
    Excel 2019
    Posts
    7,064

    Re: How to count # of items followed by a specific value in a column?

    If column A is all numbers then you dont have to check anything there.
    It's simply how many 8's are in column B use

    COUNTIF(B1:B1000,"8")

    But if you want to know how many "8" are in column B that have, e.g. "abc" in column A then use

    COUNTIFS(A1:A1000,"abc",B1:B1000,"8")
    Regards
    Special-K

    Ensure you describe your problem clearly, I have little time available to solve these problems and do not appreciate numerous changes to them.

  3. #3
    Forum Contributor
    Join Date
    04-02-2012
    Location
    Ohio
    MS-Off Ver
    Excel 2010
    Posts
    452

    Re: How to count # of items followed by a specific value in a column?

    If you have the value 3 in A1, and the value 8 in A2, are you wanting to count the 3? If so something like =countif(A:A,8) would work. It would actually count the number 8 rather than the numbers that are in the row prior to a value of 8.

    If that doesn't meet your needs try uploading a sample workbook that shows what exactly you require.

  4. #4
    Registered User
    Join Date
    07-16-2011
    Location
    Boston
    MS-Off Ver
    Excel 2003
    Posts
    12

    Re: How to count # of items followed by a specific value in a column?

    Sorry I was unclear. What I need to count are the number of 8's that are preceded by a non-8 in the previous value.
    For example, if my column was

    1
    2
    8
    8
    8
    4
    5
    8
    3

    then I want to have the answer 2, because there are 2 8's following non-8 numbers (the ones after the 2 and the 5).

+ 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] Need to count items in column that match multiple data items
    By bclucas55 in forum Excel Formulas & Functions
    Replies: 6
    Last Post: 03-27-2014, 10:03 AM
  2. [SOLVED] VBA copies rows based on specific items in a column but need to rename items created
    By djfscouse in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 07-06-2013, 11:38 PM
  3. Count if the row includes two specific items
    By tabfri in forum Excel General
    Replies: 7
    Last Post: 11-29-2012, 04:03 PM
  4. count of items under specific category
    By meetvivek72 in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 07-07-2011, 10:30 AM
  5. Replies: 3
    Last Post: 01-21-2010, 06:58 AM

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