+ Reply to Thread
Results 1 to 12 of 12

Counting Cell value change in a column using macros

  1. #1
    Registered User
    Join Date
    08-27-2013
    Location
    Delhi, India
    MS-Off Ver
    Excel 2010
    Posts
    6

    Exclamation Counting Cell value change in a column using macros

    I am working on making a counter for a column.
    The values in that column are either 0(off) or 1(on).

    I want to know the count of how many times the switch goees from off to on(0 to1).

    I have tried countf, sumproduct but none have worked out.

    I then found a manual solution & used =IF(Cell2=0,IF(Cell1=1,1,0),0) in a New column next to it.

    Then did a sum of the new column.

    Can someone help work out a macro on this?

    8EDIT* I also tried recording a macro but it wasn't working properly snce I could not get the same last row used in different files.
    Attached Files Attached Files
    Last edited by anshul1516; 08-30-2013 at 01:44 AM. Reason: Attached Files for reference

  2. #2
    Forum Guru :) Sixthsense :)'s Avatar
    Join Date
    01-01-2012
    Location
    India>Tamilnadu>Chennai
    MS-Off Ver
    2003 To 2010
    Posts
    12,770

    Re: Counting Cell value change in a column using macros

    Please attach a sample workbook with enough data to make it clear what is needed. Include a BEFORE sheet and an AFTER sheet in the workbook if needed to show the process you're trying to complete or automate. Make sure your desired results are demonstrated, mock them up manually if needed. Remember to desensitize the data.

    Click on GO ADVANCED and use the paperclip icon to open the upload window.

    View Pic

    Note: Please don't attach documents containing confidential data like (address, telephone, ID#s, etc.).


    If your problem is solved, then please mark the thread as SOLVED>>Above your first post>>Thread Tools>>
    Mark your thread as Solved


    If the suggestion helps you, then Click *below to Add Reputation

  3. #3
    Registered User
    Join Date
    08-27-2013
    Location
    Delhi, India
    MS-Off Ver
    Excel 2010
    Posts
    6

    Re: Counting Cell value change in a column using macros

    Files have been attached. Thank you for your help.
    Attached Files Attached Files

  4. #4
    Forum Guru :) Sixthsense :)'s Avatar
    Join Date
    01-01-2012
    Location
    India>Tamilnadu>Chennai
    MS-Off Ver
    2003 To 2010
    Posts
    12,770

    Re: Counting Cell value change in a column using macros

    Using a single cell formula without any helper column and all

    Formula: copy to clipboard
    Please Login or Register  to view this content.

  5. #5
    Registered User
    Join Date
    08-27-2013
    Location
    Delhi, India
    MS-Off Ver
    Excel 2010
    Posts
    6

    Re: Counting Cell value change in a column using macros

    I have a set of similar files, so is it possible to create a macro which will do the same calculation?
    Because each file has different last rows.

    I really appreciate the help.

  6. #6
    Forum Guru :) Sixthsense :)'s Avatar
    Join Date
    01-01-2012
    Location
    India>Tamilnadu>Chennai
    MS-Off Ver
    2003 To 2010
    Posts
    12,770

    Re: Counting Cell value change in a column using macros

    What is your exact excel version? Is that values are always stay in Column-A & Column-B? Can we determine the last row based on the Column-B Data?

  7. #7
    Registered User
    Join Date
    08-27-2013
    Location
    Delhi, India
    MS-Off Ver
    Excel 2010
    Posts
    6

    Re: Counting Cell value change in a column using macros

    In the exact data,
    the Column which I need the macro for is column AO always.
    The last row used is of the last row of AO only.
    The Excel I use is Office 2010.

  8. #8
    Forum Guru :) Sixthsense :)'s Avatar
    Join Date
    01-01-2012
    Location
    India>Tamilnadu>Chennai
    MS-Off Ver
    2003 To 2010
    Posts
    12,770

    Re: Counting Cell value change in a column using macros

    Thanks for the confirmation at the same time please update your profile.

    You can refer the suggested formula to whole columns too...

    Please confirm the next column address whether it is AP?

  9. #9
    Registered User
    Join Date
    08-27-2013
    Location
    Delhi, India
    MS-Off Ver
    Excel 2010
    Posts
    6

    Re: Counting Cell value change in a column using macros

    Yes,the next column AP should be inserted & contain the count.

    Thanks!
    I will update my profile as well.

  10. #10
    Forum Guru :) Sixthsense :)'s Avatar
    Join Date
    01-01-2012
    Location
    India>Tamilnadu>Chennai
    MS-Off Ver
    2003 To 2010
    Posts
    12,770

    Re: Counting Cell value change in a column using macros

    Try this...

    Please Login or Register  to view this content.

  11. #11
    Registered User
    Join Date
    08-27-2013
    Location
    Delhi, India
    MS-Off Ver
    Excel 2010
    Posts
    6

    Re: Counting Cell value change in a column using macros

    Thank you so much for your help. It works perfectly.

    I modified it a bit by removing the First IF condition.

    Thanks again!

  12. #12
    Forum Guru :) Sixthsense :)'s Avatar
    Join Date
    01-01-2012
    Location
    India>Tamilnadu>Chennai
    MS-Off Ver
    2003 To 2010
    Posts
    12,770

    Re: Counting Cell value change in a column using macros

    Glad it helps you and thanks for the feedback and rep

    If that takes care of your original question, please select Thread Tools from the menu link above and mark this thread as SOLVED. Thanks.

+ 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] Macros to Change cell values based on value of other cell
    By drawingtheline in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 01-17-2013, 03:54 PM
  2. Macros to filter a column and change the value on a particular criteria
    By sriram170 in forum Excel - New Users/Basics
    Replies: 2
    Last Post: 06-20-2012, 12:05 PM
  3. [SOLVED] macros to change fonts in range depending on cell value
    By vash1628 in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 05-28-2012, 03:51 PM
  4. Macros to change a cell value by clicking and to take you to another sheet
    By jhelliar in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 11-09-2011, 10:05 AM

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