A family of Microsoft spreadsheet software with tools for analyzing, charting, and communicating data.
Hi SaraHenry,
Thanks for contacting us,
To achieve the result you want, you need to use a formula that can sum up the values in column B based on the condition in column A. One possible formula is the SUMIF function, which can sum the values in a range that meet a certain criteria.
However, the SUMIF function alone is not enough, because you also need to reset the sum whenever there is a number "9" in column A. To do that, you need to use another function that can count how many times the number "9" appears in column A up to the current row. One possible function is the COUNTIF function, which can count the number of cells in a range that meet a certain criteria.
By combining the SUMIF and COUNTIF functions, you can create a formula that can sum up the values in column B based on the condition in column A and reset the sum whenever there is a number "9" in column A. Here is an example of such a formula:
=SUMIF (A$2:A2, "<>9", B$2:B2) - SUMIF (A$2:A2, "<>9", B$2:B2) * COUNTIF (A$2:A2, "=9")
This formula works as follows:
- The first SUMIF function sums up the values in column B from row 2 to the current row, excluding the rows where column A is "9".
- The second SUMIF function does the same thing, but multiplies the result by the number of times the number "9" appears in column A from row 2 to the current row, using the COUNTIF function.
- The formula then subtracts the second SUMIF result from the first SUMIF result, effectively resetting the sum whenever there is a number "9" in column A.
To use this formula, you need to enter it in cell C2 and then copy it down to the rest of the column. You can use the fill handle or the keyboard shortcut Ctrl+D to do that. You should see the result you want in column C.
Let me know if this helps or if you need further assistance.
Regards, Sola
“Give back to the Community. Help the next person who has this issue by indicating if this reply solved your problem. Click Yes or No below. “
Kindly note that this is a user to user forum, we are users helping other users, we aren't Microsoft employee neither are we Microsoft agents.