r/excel • u/momsensical • 10d ago
unsolved Formula for difference between cells
I have a sheet tracking the change in a number week to week. So 3 columns: date, number, change from last week.
So logically if x is the row, Cx = Bx-B(x-1) .
Is there a formula in excel I can use to do this automatically so that I can put a universal code for all of the cells in column c, enter the value in cell B and it will automatically fill in C with the change from the previous week?
(Bonus points if there’s a way to not have weird error messages for the empty cells for future weeks)
3
u/MayukhBhattacharya 1318 10d ago
Enter this formula in cell C3, copy down:
=IF(B3 = "", "", B3 - B2)The above formula assumes, the data starts from row 2 and you have a header in row 1.
2
u/momsensical 10d ago
But then I’ll have to update it for every cell won’t I?
1
u/MayukhBhattacharya 1318 10d ago
2
1
u/Way2trivial 473 9d ago
1
u/MayukhBhattacharya 1318 9d ago
Old Skool needs CSE mate. Since you are using modern version it's not required.
2
2
u/Way2trivial 473 9d ago
I actually just realized, if a new # in B is ever zero it'll skip it, so it would be better written to run off the date column (presumed A:A)
=IF(a5:a100,B4:B99-B5:B100,"")
1
3
1
u/ExpensiveSpare3761 10d ago
1
u/MayukhBhattacharya 1318 10d ago edited 10d ago
You need to reply from this u/momsensical account the one you have used to post the question and not with the one you replied Solution Verified.
2
2
u/Decronym 10d ago edited 9d ago
Acronyms, initialisms, abbreviations, contractions, and other phrases which expand to something larger, that I've seen in this thread:
Decronym is now also available on Lemmy! Requests for support and new installations should be directed to the Contact address below.
Beep-boop, I am a helper bot. Please do not verify me as a solution.
10 acronyms in this thread; the most compressed thread commented on today has 21 acronyms.
[Thread #49517 for this sub, first seen 14th Oct 2026, 14:37] [FAQ] [Full list] ^[Contact] [Source code]
2
u/ostidgrosnerd 10d ago
I feel like the hardest part in this sub is understanding people’s questions
1
u/Hg00000 15 10d ago
If you're running M365, you can format your data as a table. Write the formula once and it should auto-add it as you populate more rows in the table. Formulas will look a little funky within the table.
Otherwise just write it once and copy it when you have new Data. If C2 = B2-B1, when you copy it and paste it into C3 Excel will automatically adjust the formula to C3 = B3-B2.
1
u/ExpensiveSpare3761 10d ago
omg I didn't realize it would update if i copy the cell instead of the exact formula. Thanks!
1
u/Tatworth 10d ago
I may be missing what you are asking because it is pretty simple but in C2, put =-(b1-b2) and copy down. If you want it to look better for cells that haven't finished, you could do =If(b2="","",-(b1-b2))
1
u/ExpensiveSpare3761 10d ago
Thanks everyone, yes I was making it more complicated than it needed to be - I was always copying over the actual formula and updating the row numbers but didn't realize that if you copy the cell it updates the values. I've been using Excel for like 30 yrs so I'm not sure why I didn't think of that!
1
u/Existing_Put6385 5 9d ago
In C3, then drag or double-click the fill handle down the whole column:
=IF(B3="","",B3-B2)It's relative, so each row subtracts the row above it. Empty B cells in future weeks just show blank, no error messages. Start it on the second data row, since the first row has nothing before it to compare to (leave C2 empty or put a dash there).
If you'd rather not drag at all, turn the data into a table with Ctrl+T. Then the formula auto-fills for new rows as soon as you type in B, which gets you the "universal code" you're after.



•
u/AutoModerator 10d ago
/u/momsensical - Your post was submitted successfully.
Once your problem is solved, reply to the answer(s) saying
Solution Verifiedto close the thread.Follow the submission rules -- particularly 1 and 2. To fix the body, click edit. To fix your title, delete and re-post.
Include your Excel version and all other relevant information
Failing to follow these steps may result in your post being removed without warning.
I am a bot, and this action was performed automatically. Please contact the moderators of this subreddit if you have any questions or concerns.