+ Reply to Thread
Results 1 to 19 of 19

how to count total #s

  1. #1
    Registered User
    Join Date
    08-16-2017
    Location
    East Lyme
    MS-Off Ver
    10
    Posts
    37

    how to count total #s

    Hi, I have a simple question. I am trying to count the total #s in one dynamic cell. Saying A1 is the live cell and its value is changing between 1 and 0. I want A2 shows sums of A1. I tried A2=A2+A1 but it doesn't work. Please help, thanks!

  2. #2
    Forum Guru Jonmo1's Avatar
    Join Date
    03-08-2013
    Location
    Bryan, TX
    MS-Off Ver
    Excel 2010
    Posts
    9,763

    Re: how to count total #s

    You need VBA Code for that.

    Right click your sheet's tab, and select View Code
    Paste the following

    Please Login or Register  to view this content.

  3. #3
    Registered User
    Join Date
    08-16-2017
    Location
    East Lyme
    MS-Off Ver
    10
    Posts
    37

    Re: how to count total #s

    Cool~ I found the view code is not activated either Macro. How can I activate them? Many thanks!

  4. #4
    Forum Guru Jonmo1's Avatar
    Join Date
    03-08-2013
    Location
    Bryan, TX
    MS-Off Ver
    Excel 2010
    Posts
    9,763

    Re: how to count total #s

    Do you mean the option greayed out, or is it not there all ?
    You probably need to enable macros (File - Options - Trust Center
    Trust Center Settings
    Macro Settings.

  5. #5
    Registered User
    Join Date
    08-16-2017
    Location
    East Lyme
    MS-Off Ver
    10
    Posts
    37

    Re: how to count total #s

    I did "enable Macro and VBA" in Trust setting but still not work :-).

  6. #6
    Registered User
    Join Date
    08-16-2017
    Location
    East Lyme
    MS-Off Ver
    10
    Posts
    37

    Re: how to count total #s

    yes, the option grayed out.

  7. #7
    Forum Guru Jonmo1's Avatar
    Join Date
    03-08-2013
    Location
    Bryan, TX
    MS-Off Ver
    Excel 2010
    Posts
    9,763

    Re: how to count total #s

    Devine "still not work"

    Is "View Code" Greyed out, or not there at all ?
    Are you actually using Excel? Or an online version of software 'similar to' Excel ?

  8. #8
    Registered User
    Join Date
    08-16-2017
    Location
    East Lyme
    MS-Off Ver
    10
    Posts
    37

    Re: how to count total #s

    Do I need to enable activeX :-)?

  9. #9
    Valued Forum Contributor Root_'s Avatar
    Join Date
    07-29-2017
    Location
    _
    MS-Off Ver
    2010+
    Posts
    484

    Re: how to count total #s

    Just to mention: if A1 changes as a result of recalculation (i.e., has a formula) then the Worksheet.Change event will not work.

  10. #10
    Registered User
    Join Date
    08-16-2017
    Location
    East Lyme
    MS-Off Ver
    10
    Posts
    37

    Re: how to count total #s

    Thanks for the help! I am using Excel 2010. And the view code is there just I couldn't access to it it was greyed out like you said :-).

  11. #11
    Forum Guru Jonmo1's Avatar
    Join Date
    03-08-2013
    Location
    Bryan, TX
    MS-Off Ver
    Excel 2010
    Posts
    9,763

    Re: how to count total #s

    @Root_
    Good point.

    @hh2017
    I think you need a thread in the VBA forum.
    https://www.excelforum.com/excel-pro...ng-vba-macros/

  12. #12
    Registered User
    Join Date
    08-16-2017
    Location
    East Lyme
    MS-Off Ver
    10
    Posts
    37

    Re: how to count total #s

    It seems Excel was not connecting to the internet. I reinstall the office, it was still not working. Any idea? Thank you~!

  13. #13
    Registered User
    Join Date
    08-16-2017
    Location
    East Lyme
    MS-Off Ver
    10
    Posts
    37

    Re: how to count total #s

    I got the help from VBA forum. I actually didn't install visual basic because it was included in Microsoft access not in excel :-). I ran the code, it worked. Thanks so much!

  14. #14
    Forum Guru Jonmo1's Avatar
    Join Date
    03-08-2013
    Location
    Bryan, TX
    MS-Off Ver
    Excel 2010
    Posts
    9,763

    Re: how to count total #s

    You're welcome.

  15. #15
    Registered User
    Join Date
    08-16-2017
    Location
    East Lyme
    MS-Off Ver
    10
    Posts
    37

    Re: how to count total #s

    The code didn't work for live data. If cell A1 is a live cell, A2 didn't show anything. If I manually inserted values into A1, it worked. Any idea :-)? Thanks!
    Last edited by hh2017; 08-22-2017 at 02:48 PM.

  16. #16
    Forum Guru Jonmo1's Avatar
    Join Date
    03-08-2013
    Location
    Bryan, TX
    MS-Off Ver
    Excel 2010
    Posts
    9,763

    Re: how to count total #s

    You're going to need to clarify.

    If you do this to the whole column A, you'll be creating a circular reference.
    Say A2 changes, you add that to A3
    Changing A3 triggers the code again, and adds that value to A4
    changing A4 triggers the code again, and adds that value to A5
    etc.

    Do you perhaps add the values to column B?
    If A2 changes, add that value to B2 ?
    If A10 changes, add that value to B10 ?

  17. #17
    Registered User
    Join Date
    08-16-2017
    Location
    East Lyme
    MS-Off Ver
    10
    Posts
    37

    Re: how to count total #s

    Hi, I have tested this code. It worked perfectly to accumulate A1 values into B1. But it didn't work for the live data. If cell A1 is a live cell, A2 didn't show anything. If I manually inserted values into A1, it worked.

    Sorry I deleted the previous post :-). What I meant is just to do the same process for A2 and B2. I can extend the code in a simple way but I have hundreds of rows of data, so need to do something like "for i=i+1 next", just don't know how to write a VBA code :-).

    Thanks!
    Last edited by hh2017; 08-22-2017 at 03:02 PM.

  18. #18
    Forum Guru Jonmo1's Avatar
    Join Date
    03-08-2013
    Location
    Bryan, TX
    MS-Off Ver
    Excel 2010
    Posts
    9,763

    Re: how to count total #s

    What do you mean by 'live' ?
    Is A1 a formula ?
    What is that formula?

    You really need to discuss this in the VBA forum.
    I don't think the issue is simple anymore, and it's not appropriate in the formulas forum.

    Feel free to link to this thread when you make a new thread in the VBA forum.
    Or maybe a moderator can just move this one over there.

  19. #19
    Registered User
    Join Date
    08-16-2017
    Location
    East Lyme
    MS-Off Ver
    10
    Posts
    37

    Re: how to count total #s

    OK, I move it to VBA group. 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. Replies: 2
    Last Post: 09-16-2015, 02:17 AM
  2. total Row Count
    By Cupragsw in forum Excel General
    Replies: 2
    Last Post: 01-02-2014, 12:47 PM
  3. total Row Count
    By Cupragsw in forum Excel General
    Replies: 2
    Last Post: 01-02-2014, 12:23 PM
  4. [SOLVED] count occupied cells, but put count total in different worksheet
    By NewbieOfVBA in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 07-24-2012, 07:30 PM
  5. Total Count
    By echen in forum Excel General
    Replies: 3
    Last Post: 06-19-2012, 01:21 PM
  6. Add total count
    By phong919 in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 08-26-2008, 12:54 PM
  7. How do i count numbers and letters to find a total count of all
    By Linda in forum Excel Formulas & Functions
    Replies: 4
    Last Post: 11-10-2005, 12:55 PM

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