Results 1 to 3 of 3

Thread: On Going Calculation

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Administrator Admin's Avatar
    Join Date
    Mar 2011
    Posts
    1,123
    Rep Power
    10
    Hi

    The question is not clear.

    ...I tried writing a code for each column from BR6 to DP20 to go to each section Cell and column starting at GU3 . One of the members at excel.com a while back show me how to write a on- going calculation to go To one cell , which is what I had asked for and it worked. But trying to write it for more than one cell...
    may be..

    Code:
    Private Sub Worksheet_Change(ByVal Target As Excel.Range)
        
        '//if the target range is in anywhere on range "BY6:DP20"
        If Not Intersect(Target, Range("BY6:DP20")) Is Nothing Then
            With Target
                If IsNumeric(.Value) Then
                    Application.EnableEvents = False
                    Range("GU3").Value = Range("HB3").Value + 1
                    Range("GB4").Value = Range("HB4").Value + 1
                    Range("GB5").Value = Range("HB5").Value + 1
                    Range("GB6").Value = Range("HB6").Value + 1
                    Range("GB12").Value = Range("HB12").Value + 1
                    Range("GB13").Value = Range("HB13").Value + 1
                    Range("GB14").Value = Range("HB14").Value + 1
                    Range("GB15").Value = Range("HB15").Value + 1
                    Application.EnableEvents = True
                End If
            End With
        End If
        
    End Sub
    Cheers !

    Excel Range to BBCode Table
    Use Social Networking Tools If You Like the Answers !

    Message to Cross Posters

    @ Home - Office 2010/2013/2016 on Win 10 (64 bit); @ Work - Office 2016 on Win 10 (64 bit)

  2. #2
    Junior Member
    Join Date
    Dec 2013
    Posts
    7
    Rep Power
    0
    Thanks for your reply. What I'm trying to do is to build and keep a 30 day on going calculation for cells BY6 to DP20.
    I posted just 2 of the 130 sections it will take to complete my project. I will put in the rest once I, well you figure out
    what I need to do to make this work.
    The only thing I change in your code was the letters.
    You started with Range("GU3").Value = Range("HB3").Value + 1 which is correct. But from there you put
    Range("GB4").Value = Range("HB4").Value + 1. I'm hoping using GB4 to GB15 was a typo. So I changed them all back to GU. The cell value numbers in cells BY6 to DP20 change daily as I download the results.

    I put your code in this way, I clicked BY6 , click Developer and clicked view code. then I copied and pasted your code.
    Each section and each cell starting with GU3 is identified by Grade and Distance (A, B,C,D,M) (550, 660, 770)
    =COUNTIFS(BY$6:BY$20,1,$BR$6:$BR$20,"A",$BS$6:$BS$ 20,550)
    showing that GU3 is looking for any race that is Grade A and running distance of 550 coming from cells BY6 thru DP20.

    This part works great with all the results from BY6 thru DP20 going to the right section and cell.

    After putting in your code I went back 5 races but each time all I get starting with GU thru HB3 and through out to GU15 to HB15 were the value in BY6 thru DP20, were the downloaded valve that day.

    The cells starting with GU3 were not keeping a on going total. I was hoping using these codes would keep a on going calculation totals would work.
    Did I put the code in wrong because I get this error each time I download the results.
    ------------------------------------------------------------------------------------------------------------------
    Block If without End If
    An error occurred due to an incomplete statement. This error has the following cause and solution:

    ##An If statement is used without a corresponding End If statement.
    A multiline If statement must terminate with a matching End If statement. For nested If...End If statements, make sure

    there is a correctly matched If...End If structure inside each enclosing If...End If structure.
    ------------------------------------------------------------------------------------------------------------------
    For some reason the numbers do not add up. They just give the downloaded value put in BY6 thru DP20 that day.
    Is there something else I need to do or another way to do it.

    Being retired I have a lot of time on my hands and keeping up with Greyhounds and trying to learn enough about
    excel to make it easier for me to see how the dogs are doing is how I spend a lot of it.
    But when I put the results in BY6 thru DP20, my total sections starting with GU3 are supposed to show me what grades and distance and how many times the speed, early speed, late speed etc. you know how many times the top speed dogs finished first and how many time it was 8th in the last 30 days, and same for the rest.

    I hope this help explain what I'm trying to do and what the purpose of both charts are for. one the results, two the
    totals. if this format is not set right, hopefully you or someone can help me figure out how to do this.
    Thanks
    Last edited by justme1052; 12-31-2013 at 02:18 AM.

Similar Threads

  1. Replies: 5
    Last Post: 10-21-2013, 04:43 PM
  2. Correcting “Negative” Time Difference Calculation in Excel
    By Transformer in forum Tips, Tricks & Downloads (No Questions)
    Replies: 0
    Last Post: 05-17-2013, 12:32 AM
  3. Formula Following Order Of Calculation BODMAS
    By paul_pearson in forum Excel Help
    Replies: 7
    Last Post: 03-27-2013, 02:07 PM
  4. Hours Calculation between two times
    By excel_learner in forum Excel Help
    Replies: 3
    Last Post: 11-21-2012, 05:04 PM
  5. Calculation with different condition in a cell
    By LalitPandey87 in forum Excel Help
    Replies: 5
    Last Post: 04-04-2012, 08:38 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •