Closed Thread
Results 1 to 7 of 7

Count number of value changes in a column

  1. #1
    Registered User
    Join Date
    04-20-2011
    Location
    USA
    MS-Off Ver
    Excel 2007
    Posts
    7

    Count number of value changes in a column

    I have a spreadsheet in which each column contains cells with either a Y or a Z. I need a formula that looks at a range of cells and from top to bottom goes down the column and counts the number of times the value changes from Y to Z and Z to Y.

    Not sure if this belongs in the countif or sumproduct arena, but any help would be appreciated. Thanks!
    Attached Files Attached Files
    Last edited by scoffman; 06-13-2011 at 10:17 PM. Reason: Solved

  2. #2
    Forum Guru
    Join Date
    05-24-2011
    Location
    India
    MS-Off Ver
    Office 2021
    Posts
    2,237

    Re: Count number of value changes in a column

    Hello, Try this;

    =SUMPRODUCT(--(B3:B31<>B2:B30))
    Regards,
    Haseeb Avarakkan

    __________________________________
    "Feedback is the breakfast of champions"

  3. #3
    Forum Expert Ron Coderre's Avatar
    Join Date
    03-22-2005
    Location
    Boston, Massachusetts
    MS-Off Ver
    2013, 2016, O365
    Posts
    6,996

    Re: Count number of value changes in a column

    Using your posted workbook...
    This regular formula returns the count of letter toggles for Col_B
    Please Login or Register  to view this content.


    Copy that formula across through D33

    Using your posted data these are the results:
    B33: 5
    C33: 1
    D33: 3

    Is that something you can work with?
    Ron
    Former Microsoft MVP - Excel (2006 - 2015)
    Click here to see the Forum Rules

  4. #4
    Registered User
    Join Date
    04-20-2011
    Location
    USA
    MS-Off Ver
    Excel 2007
    Posts
    7

    Re: Count number of value changes in a column

    Thank you!

  5. #5
    Registered User
    Join Date
    12-20-2012
    Location
    United States
    MS-Off Ver
    Excel 2003
    Posts
    6

    Re: Count number of value changes in a column

    Sorry about posting in an old thread, but this thread helped me solve my problem. I had to count the number of times that a valve opened during the course of a day. The time stamped data showed a 1.00 when the valve was opened and a 0.00 when the valve was closed. I didn't want to count the number of times that the valve closed, as the formula above would have done. It also would have counted intermediate values.
    0:00:01 0.00
    0:00:02 0.33
    0:00:03 1.00
    0:00:03 1.00
    0:00:04 0.75
    0:00:05 0.00

    The previous formula would have counted this data above as 4, but really the valve only opened (went to 1.00) once. So I Ron's formula to what you see below.
    Formula: copy to clipboard
    Please Login or Register  to view this content.


    This is a great forum. I've learned much from these pages.
    Last edited by danpool; 01-02-2014 at 01:48 PM.

  6. #6
    Registered User
    Join Date
    11-14-2014
    Location
    Belfast
    MS-Off Ver
    2010
    Posts
    8

    Re: Count number of value changes in a column

    Hi ... I have a similar but different query.
    I want a solution that will track the number of times a cell changes value, but I would like the output of this calculation or sum in the adjacent cell.
    For example: Column B, I have a date and time field in format [dd/mm/yy_hh:mm]- This gets updated as an event changes, and now so often that the number of changes must be counted for a KPI.

    thus I would like my table to display... Cell B1 = [dd/mm/yy_hh:mm]. Cell C1= Number of changes to B1.

    Can anybody help?

  7. #7
    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,194

    Re: Count number of value changes in a column

    Sp00gles. Please do not post your query in a long-dead thread. It's against the rules. Please start your OWN thread.

    Thread closed.
    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

Closed Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Tags for this Thread

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