Auto Cumulate

help needed yes please

Board Regular
Joined
Apr 19, 2018
Messages
63
Office Version
  1. 2010
Hi, I havea column ‘A’ which is numerical. I <o:p></o:p>
I: want tohave a cell in another column which will auto increase by ‘1’ each time anentry is made in column ‘A’<o:p></o:p>
I Calculatecolumn ‘A’ in 30 day cycles. So:<o:p></o:p>
IE: A103should show number in designated cell (Example G50) ‘13’<o:p></o:p>
When entry placed in A104 shows in G50 ‘14’ I am lost here so any help be great. Thanks.Frank:confused:<o:p></o:p>
 

Excel Facts

Quick Sum
Select a range of cells. The total appears in bottom right of Excel screen. Right-click total to add Max, Min, Count, Average.
Try this:
This is an auto sheet event script
Your Workbook must be Macro enabled
To install this code:
Right-click on the sheet tab
Select View Code from the pop-up context menu
Paste the code in the VBA edit window

Any time you enter any value in Column A the value in Range("G50") will increase by one.
This entry must be entered in column A manually and not as a result of a formula.
Code:
Private Sub Worksheet_Change(ByVal Target As Range)
'Modifed 5/15/18 10:35 PM EDT
If Not Intersect(Target, Range("A:A")) Is Nothing Then
If Target.Cells.CountLarge > 1 Or IsEmpty(Target) Then Exit Sub
Range("G50").Value = Range("G50").Value + 1
End If
End Sub
 
Upvote 0
Here is my answer to account for the 30-day cycle. (Same code installation as described above)
Code:
Private Sub Worksheet_Change(ByVal Target As Range)
    If Not Intersect(Target, Range("A:A")) Is Nothing Then
        Range("G50").Value = Cells(Rows.Count, 1).End(xlUp).Row Mod 30
        If Range("G50").Value = 0 Then Range("G50").Value = 30
    End If
End Sub
 
Upvote 0
Hi, My only experience is in entering into a cell (Say G59) data like =Sum(blah:Blah) Could you walk me through how to enter the formula you so kindly worked out? I have seen formulas presented elsewhere here and feel so silly I don't know how to understand it. Thanks, frank
 
Upvote 0
Hi, please see my response to entry below. I am a bit lost, if you could walk me through the 'HOW' to enter your formula. Thanks frank.
 
Upvote 0
Not sure what your question is.
I gave you these instructions on how to install your script.
This is an auto sheet event script
Your Workbook must be Macro enabled
To install this code:
Right-click on the sheet tab
Select View Code from the pop-up context menu
Paste the code in the VBA edit window
 
Upvote 0
Hello, I shall try to rut more clarity into my query.( I have done a good job of mucking it up thus far)
A B C D E F<o:p></o:p>
17/05/2018<o:p></o:p>
9am<o:p></o:p>
th<o:p></o:p>
4881<o:p></o:p>
180<o:p></o:p>
18/05/2018<o:p></o:p>
8am<o:p></o:p>
f<o:p></o:p>
5081<o:p></o:p>
200<o:p></o:p>
<tbody> </tbody>
<o:p> </o:p>
F30<o:p></o:p>
The number shownin D1 is 4881 which is the 18th day of a 30 day cycle (F30 show 12)<o:p></o:p>
D2 is 5018which is the 19th day of a 30 day cycle.(F30 show 11)<o:p></o:p>
I am tryingto put a formula into Cell F30 which sequentially worksbackward.<o:p></o:p>
IE: As the numberof days into 30 day cycle increases <o:p></o:p>
Cell F30shows 1 day less as balance. (30 down to 1) Hope that helps you to help me as I have not been able to understand the advice so far. NOT YOUR FAULT , regards Frank<o:p></o:p>
 
Upvote 0
What about my code updated based on your new information?

Code:
Private Sub Worksheet_Change(ByVal Target As Range)
    Dim r as Integer
    If Not Intersect(Target, Range("A:A")) Is Nothing Then
        r = Cells(Rows.Count, 1).End(xlUp).Row
        Range("F30").Value = Cells(r, 4).Value Mod 30
        If Range("F30").Value = 0 Then Range("F30").Value = 30
    End If
End Sub

Although, mine shows that 4881 is day 21 (4860 is divisible by 30), and 5018 is day 8 (5010 is divisible by 30).
 
Last edited:
Upvote 0
Never mind. I just re-read your explanation about counting down, not up. My code counts up.
 
Upvote 0

Forum statistics

Threads
1,214,812
Messages
6,121,699
Members
449,048
Latest member
81jamesacct

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top