Sum values from the current row backwards until string is found

Every Saturday I want to sum values from the current row backwards to the previous sunday or 7 rows back. The by row method has more flexibility and I don’t have to worry that I have the correct absolute rows. Is there another way besides using indirect.

I’d also like to sum backwards until a certain string. What functions should I look at?

Should I be wrapping, at least the by row, with error handling for boundary cases (i.e., top of data and less than 7 rows or no string match)?

# By Absolute
=IF(WEEKDAY(A17)=7,SUM($B11:$B17),"")

# By Row
=IF(WEEKDAY(A17)=7,SUM(INDIRECT("B" & ROW() & ":B" & (ROW()-7))),"")
A               B   C
2025-10-31, Fri	18
2025-11-01, Sat	17  35
2025-11-02, Sun	16
2025-11-03, Mon	14
2025-11-04, Tue	10
2025-11-05, Wed	15
2025-11-06, Thu	12
2025-11-07, Fri	15
2025-11-08, Sat	15  97
2025-11-09, Sun	14

Data → Pivot Table


Untitled2.ods (28,8 KB)

2 Likes