+ Reply to Thread
Results 1 to 10 of 10

Thread: How to count change in column

  1. #1
    Forum Contributor
    Join Date
    06-28-2011
    Location
    London, England
    MS-Off Ver
    Excel 2003
    Posts
    102

    How to count change in column

    Hi
    I am generating lots of read in one column
    around over 1000, it is done using some addon
    that is not the problem, the problem is how to count the change in the column

    the column will only contain OPEN OR CLOSE
    it could be either
    CLOSE
    CLOSE
    CLOSE
    OPEN
    CLOSE
    CLOSE
    OPEN
    OPEN
    OPEN
    CLOSE

    so what I need to do it count the number of change of status
    for this above example it would be 4 times it changed in entier so I need to findout the way to count the number of changes please help
    Thank you
    zit
    Last edited by zit1343; 06-30-2011 at 01:18 PM.

  2. #2
    Forum Guru NBVC's Avatar
    Join Date
    12-06-2006
    Location
    Mississauga, CANADA
    MS-Off Ver
    2003:2010
    Posts
    32,636

    Re: How to count change in column

    If your range is in A1:A10, then try:

    =SUMPRODUCT(--(A1:A9="Close"),--(A2:A10="Open"))+SUMPRODUCT(--(A1:A9="Open"),--(A2:A10="Close"))
    Microsoft MVP - Excel

    Where there is a will there are many ways. Pick One!


    Please read the Forum Rules

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

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

    Preferred Charities: Lupus Canada and Sick Kids Foundation.
    Feel Free to Donate if you want to, for the assistance you received today.

  3. #3
    Forum Contributor
    Join Date
    06-28-2011
    Location
    London, England
    MS-Off Ver
    Excel 2003
    Posts
    102

    Re: How to count change in column

    hey what if I do not know the limit is going up to,
    it is different everytime

  4. #4
    Forum Guru NBVC's Avatar
    Join Date
    12-06-2006
    Location
    Mississauga, CANADA
    MS-Off Ver
    2003:2010
    Posts
    32,636

    Re: How to count change in column

    In a separate column, say in B1, enter formula:

    =MATCH(REPT("z",255),A:A) this will get last row in column A that is occupied.

    Then change formula to:

    =SUMPRODUCT(--(A1:INDEX(A:A,$B$1-1)="Close"),--(A2:INDEX(A:A,$B$1)="Open"))+SUMPRODUCT(--(A1:INDEX(A:A,$B$1-1)="Open"),--(A2:INDEX(A:A,$B$1)="Close"))
    Microsoft MVP - Excel

    Where there is a will there are many ways. Pick One!


    Please read the Forum Rules

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

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

    Preferred Charities: Lupus Canada and Sick Kids Foundation.
    Feel Free to Donate if you want to, for the assistance you received today.

  5. #5
    Forum Contributor
    Join Date
    06-28-2011
    Location
    London, England
    MS-Off Ver
    Excel 2003
    Posts
    102

    Re: How to count change in column

    man you are awesome, I have only one problem
    in A1 I have the Title.
    is there a way to fix it ?
    =MATCH(REPT("z",255),A:A)

  6. #6
    Forum Guru NBVC's Avatar
    Join Date
    12-06-2006
    Location
    Mississauga, CANADA
    MS-Off Ver
    2003:2010
    Posts
    32,636

    Re: How to count change in column

    Just adjust the formula accordingly:


    =SUMPRODUCT(--(A2:INDEX(A:A,$B$1-1)="Close"),--(A3:INDEX(A:A,$B$1)="Open"))+SUMPRODUCT(--(A2:INDEX(A:A,$B$1-1)="Open"),--(A3:INDEX(A:A,$B$1)="Close"))
    Microsoft MVP - Excel

    Where there is a will there are many ways. Pick One!


    Please read the Forum Rules

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

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

    Preferred Charities: Lupus Canada and Sick Kids Foundation.
    Feel Free to Donate if you want to, for the assistance you received today.

  7. #7
    Forum Contributor
    Join Date
    06-28-2011
    Location
    London, England
    MS-Off Ver
    Excel 2003
    Posts
    102

    Re: How to count change in column

    nevermind I got it
    thanx alot. let see where else do I get stuck
    I fixed it by removing by $ sign
    Last edited by zit1343; 06-30-2011 at 12:20 PM.

  8. #8
    Forum Guru NBVC's Avatar
    Join Date
    12-06-2006
    Location
    Mississauga, CANADA
    MS-Off Ver
    2003:2010
    Posts
    32,636

    Re: How to count change in column

    Perhaps you just need to move the $ from before the B's?

    =SUMPRODUCT(--(A2:INDEX(A:A,B$1-1)="Close"),--(A3:INDEX(A:A,B$1)="Open"))+SUMPRODUCT(--(A2:INDEX(A:A,B$1-1)="Open"),--(A3:INDEX(A:A,B$1)="Close"))

    If still not it, please post your workbook.
    Microsoft MVP - Excel

    Where there is a will there are many ways. Pick One!


    Please read the Forum Rules

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

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

    Preferred Charities: Lupus Canada and Sick Kids Foundation.
    Feel Free to Donate if you want to, for the assistance you received today.

  9. #9
    Forum Contributor
    Join Date
    06-28-2011
    Location
    London, England
    MS-Off Ver
    Excel 2003
    Posts
    102

    Re: How to count change in column

    I removed "$" from $B$1 to B1-1
    and it seems to be working any reason we need $ in front of 1

  10. #10
    Forum Guru NBVC's Avatar
    Join Date
    12-06-2006
    Location
    Mississauga, CANADA
    MS-Off Ver
    2003:2010
    Posts
    32,636

    Re: How to count change in column

    The $ "freezes" the column B and/or Row 1... so that when you copy across or down those don't change....

    You can remove the $ before the 1 if you want, but if you copy the formula downwards, then beware that it will then reference B2, B3, B4, etc....

    here is more on Absolute/Relative Referencing
    Microsoft MVP - Excel

    Where there is a will there are many ways. Pick One!


    Please read the Forum Rules

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

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

    Preferred Charities: Lupus Canada and Sick Kids Foundation.
    Feel Free to Donate if you want to, for the assistance you received today.

+ 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.2.0