Question: Is it possible to write a SUMIFS column formula to add up specific cells in an adjacent column where the criteria are also in other adjacent columns? (Actually, I know it's possible, because the formula I wrote a couple days ago worked just fine at first, but it's refusing to work today, and I don't know why. The formula is returning an #INVALID OPERATION error today.)
Context: I have a sheet with chunks of rows for ongoing weeks throughout the year. Each week "chunk" has a header row, data rows, and a total row. (The data rows and total row are children of the header row.) The header row for the following week is directly below the "child" total row of the previous week, so there are no breaks in the data.
What I need: I need a column formula to look at all the prior weeks and add up the rows where the job name matches the job name in the current row. I also need the formula to include the amount in the current week for that job. (This amount is in a different column of the same row as the formula in question.) For example, say I'm looking at Job X in Week 3. I need the Column Y formula in the Job X row of Week 3 to look at Column Z of Week 1, Week 2, and Week 3 and add up those values for Job X in all three weeks.
My whole formula is pretty complicated. Below is a simplified version of the portion I believe is prompting the #INVALID OPERATION error. For this example, the formula is in Column Y. Column Z and the [Invoice Amount] columns are text/number columns formatted as ($) currency. The [Job Name] column is formatted as text. The [Week #] column contains the week number (1-52) of that week.
=IF(SUMIFS([Column Z]:[Column Z], [Job Name]:[Job Name], [Job Name]@row, [Week #]:[Week #], <= [Week #]@row) > [Invoice Amount]@row, [Invoice Amount]@row - SUMIFS([Column Z]:[Column Z], [Job Name]:[Job Name], [Job Name]@row, [Week #]:[Week #], <= [Week #]@row), 0)
This formula checks if the sum of the amounts in Column Z for Job X is greater than the actual invoice amount for Job X. It then subtracts the too-large sum in Column Z from the actual invoice amount.
I know that my "less than or equal to" operators are correct, and I also know that this formula worked previously. (As in, as recently as yesterday.) I simply can't figure out why I'm getting an error now. Is there another workaround to SUMIF the weeks less than or equal to the current week?
I realize I can use absolute references to make this formula work. However, if I use absolute references, I can't convert this formula to a column formula. This formula is in a hidden column that I don't want to have to un-hide every week to extend the formulas down when I add new data.
Thanks!