sum number of cells based on current date in excel spreadsheet
excel, excel-formula
Solution
You can use SUMIF:
=SUMIF(A1:E1,"<="&TODAY(),A2:E2)
Assuming your dates are in a1:e1 and your values are in a2:e2.
Problem
I've got a spreadsheet like this: ``` date | 7/1 | 7/2 | 7/3 | 7/4 -----|-----|-----|-----|----- val | 3 | 5 | 1 | 3 -----|-----|-----|-----|----- ``` I want to sum the val row, but only up to the current date. So if today were 7/3, the sum would be 3+5+1=9. If today were 7/4, it would be 12. I figured this out to get the number of columns: ``` =YEARFRAC(B1,TODAY())*360 // B1 is the first date -- 7/1 ``` but I can't figure out how to tell excel to do the sum: ``` =SUM(B2:<B+num cols above>2) ``` Presumably its something to do with references, and lookup, but I'm not really familiar with how those work....