+ Reply to Thread
Results 1 to 7 of 7

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 want to know how to count the total #s in a live cell? Saying A1 is a dynamic cell with live data, I want A2 shows the sum of values shown in A1. I got a VBA code from Forum group. It worked perfectly when I inserted data manually into A1. But when A1 changed to live data, the code stopped working. Any idea? Thanks.

    Please Login or Register  to view this content.
    Last edited by AliGW; 08-22-2017 at 04:49 PM.

  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

    What do you mean by 'Live' ??
    Is that a formula? Can you show that formula?

    If A1 is changing via a formula, it's going to get very difficult.
    We do have a Worksheet_Calculate event code, that is similar to the Change event code.
    Change is triggered by manually changing cell values
    Calculate is triggered when a sheet is calculated for whatever reason.

    This gets tricky because there is not method I know of to know 'Which' formula changed it's value.
    So you'd have code that is changing the value of A2 everytime ANYTHING on the sheet recalculated, not necessarily just A1.

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

    Re: how to count total #s

    Oh 'Live' is data from yahoo Finance. Is there a way to spread all live data in a cell into the spreadsheet? I need all data to create a chart or do a calculation as I mentioned above. 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

    I'm sorry, but that is very vague. You assume we all know how 'yahoo finance' works.

    How 'exactly' does the value in A1 change ?
    Did yahoo finance put a formula in A1 ?
    Do you have to run a Query that updates A1 ?
    Is there a macro you run that updates A1 ?

    Just to show a little progress, here's how the calculate event code looks.
    Please Login or Register  to view this content.
    But again, this is not very good because it will run every time anything recalculates on the sheet.
    If you have a formula in Say G25 or watever, and that formula changes it's value, but the formula in A1 did not, this will still run and add A1 to A2.
    There is no method I know of to know 'which' formula changed it's value.

  5. #5
    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 code :-)! Actually I don't know exactly how the data are inserted into the excel. I think they use a RTD formula. What I really want here is to calculate #trades for each equity, So every time when the price changes, I need add 1 to A2. I ran the code. I changed the value in A1 manually but there was nothing shown in A2. I will run it again tomorrow.
    Last edited by hh2017; 08-23-2017 at 08:00 PM.

  6. #6
    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

    Attach a sample workbook. Make sure there is just enough data to demonstrate your need. 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 shown, mock them up manually if necessary.

    Remember to desensitize the data.

    Click on GO ADVANCED and then scroll down to Manage Attachments to open the upload window.

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

    Re: how to count total #s

    Hi the code is almost working for my purpose. Thank you :-)! One problem is when the A1.value changed to 1, I saw 1 was added to A2. But it didn't stop there and continued adding 1 in every second. Until A1.value changed to 0, it stopped. I want when A1=1, add 1 only once. How can I change the code? 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