I have this working formula that I'd like to expand for more flexibility:
=SUMIF(MyTable[Date],"="&$D5,MyTable[Account Balance])
Occasionally, D5
will not have a match in MyTable[Date]
range. I'd like it to do "="&$D5+1
and then +1... and so on until first match in the range is located.
The next date can be easily located on a sorted or unsorted range of dates using a COUNTIF function to rank and passing that result into a LARGE function as the k parameter.
In the following, I've used SUMIFS function syntax to provide more universality than SUMIF function (e.g. the parameters are necessarily reversed).
The standard formula in G5 is,
Fill down as necessary.
If you have blanks in the [Account Balance] column that need to be discarded, the COUNTIF function will have to become a COUNTIFS function and the LARGE function will have to become an AGGREGATE¹ function. In G5 above as,
¹ The AGGREGATE function was introduced with Excel 2010. It is not available in earlier versions.