-
Sep 6th, 2021, 05:15 AM
#1
Updating formulas for future rows
i have a formula that i may need to change the ranges within the formula on occasion, without affecting results for previous rows
a simple example is
=C5*P$3-F5+N4, where c5 is in the current row, but P$3 needs to be changed to an updated value obviously if i change the value in p3 then all previous results are also changed
the cells needs to be updated to the bottom of the sheet, but some rows contain subtotals so i can't just drag the updated formula to the bottom of the usedrange
also subtotal rows need to be skipped where N4 above is the previous row, at subtotals needs to be 1 or 2 rows above the previous row
the most complicated example is
=ROUND((SUMPRODUCT(--(J5*52>tt!A$5:A$8 ), J5*52-(tt!A$5:A$8),tt!B$5:B$8-tt!B$4:B$7))/52+J5*tt!$D$5+0.49,0)
where all the same conditions apply, though no cumulative totals are required
i have successfully converted this formula to use a named range for tt sheet ranges, but again updating the named range either by value or name will change previous result
i am looking for some simple method for any update required
i have been considering a vba solution, but thought i would post here first to see if anyone has a better method
Last edited by westconn1; Sep 6th, 2021 at 07:32 AM.
i do my best to test code works before i post it, but sometimes am unable to do so for some reason, and usually say so if this is the case.
Note code snippets posted are just that and do not include error handling that is required in real world applications, but avoid On Error Resume Next
dim all variables as required as often i have done so elsewhere in my code but only posted the relevant part
come back and mark your original post as resolved if your problem is fixed
pete
-
Sep 8th, 2021, 06:49 AM
#2
Re: Updating formulas for future rows
i think i have solved this with a vba code
but now the whole problem has become irrelevant, as the spreadsheet will probably be obsolete in a short time, and only kept for history
how things change when you turn away for a few moments
i do my best to test code works before i post it, but sometimes am unable to do so for some reason, and usually say so if this is the case.
Note code snippets posted are just that and do not include error handling that is required in real world applications, but avoid On Error Resume Next
dim all variables as required as often i have done so elsewhere in my code but only posted the relevant part
come back and mark your original post as resolved if your problem is fixed
pete
-
Sep 8th, 2021, 10:10 AM
#3
Fanatic Member
Re: Updating formulas for future rows
i think i have solved this with a vba code
AMEN to VBA, i personally never bothered with formulas for this exact reason, they work for basic home finance level calculations but the level of complexity with formulas just seems to exponentially grow when you add a simple level of complexity to it.
Its great to find a solution using a tool that simply put is mediocre at best and gives you a sense of achievement but at the end of the day... why bother. your a programmer, why recreat the wheel when you can create a UFO.
Yes!!!
Working from home is so much better than working in an office...
Nothing can beat the combined stress of getting your work done on time whilst
1. one toddler keeps pressing your AVR's power button
2. one baby keeps crying for milk
3. one child keeps running in and out of the house screaming and shouting
4. one wife keeps nagging you to stop playing on the pc and do some real work.. house chores
5. working at 1 O'clock in the morning because nobody is awake at that time
6. being grossly underpaid for all your hard work
-
Sep 9th, 2021, 04:36 AM
#4
Re: Updating formulas for future rows
why bother. your a programmer, why recreat the wheel
most code i write is just to add a missing functionality to someoneelses commercial program, very simple stuff mostly
the above spreadsheet was created by a friend, i have been updating it regularly for a few years, but now its days are numbered
i do my best to test code works before i post it, but sometimes am unable to do so for some reason, and usually say so if this is the case.
Note code snippets posted are just that and do not include error handling that is required in real world applications, but avoid On Error Resume Next
dim all variables as required as often i have done so elsewhere in my code but only posted the relevant part
come back and mark your original post as resolved if your problem is fixed
pete
-
Sep 10th, 2021, 02:41 AM
#5
New Member
Re: Updating formulas for future rows
Enter this formula: =SUM(INDIRECT("D2"&ROW()-1)) (D2 is the first cell in the list that you want to sum) at the end of the cells that you want to sum the number list, and press Enter key. Tips: The formula only work correctly when you place it at the end of the data list.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|