+ Reply to Thread
Results 1 to 2 of 2

Trying to count the number of changes from one number to another in a single column

  1. #1
    Registered User
    Join Date
    07-03-2012
    Location
    Newfoundland
    MS-Off Ver
    Excel 2007
    Posts
    3

    Trying to count the number of changes from one number to another in a single column

    So I have a column of data that is 25,000 cells long, and each cell has a one or a zero in it. I want to know how many times it changes from one to zero and vice versa. I don't know if there is a quick formula for this for if it is a VBA macro to make it happen. But any help would be appreciated. I have included a quick example showing what the input column "A" would look like and the desired output column "B" should read.

    A B
    -----
    1 |0 0
    2 |0 0
    3 |1 1
    4 |0 2
    5 |0 2
    6 |0 2
    7 |1 3
    8 |1 3
    9 |0 4

  2. #2
    Administrator FDibbins's Avatar
    Join Date
    12-29-2011
    Location
    Duncansville, PA USA
    MS-Off Ver
    Excel 7/10/13/16/365 (PC ver 2310)
    Posts
    53,049

    Re: Trying to count the number of changes from one number to another in a single column

    In C2, copied down...
    =IF(A2=A1,C1,C1+1)
    1. Use code tags for VBA. [code] Your Code [/code] (or use the # button)
    2. If your question is resolved, mark it SOLVED using the thread tools
    3. Click on the star if you think someone helped you

    Regards
    Ford

+ 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