auto change references to another sheet in the same workbook (identical formats)

Copper Contributor

I have the following formula which references "PreviousMonthsSales" sheet.

 

=SUMIF(PreviousMonthSales!$AI:$AI,"Big",PreviousMonthSales!$AE:$AE)+SUMIF(PreviousMonthSales!$AI:$AI,"Medium",PreviousMonthSales!$AE:$AE)

 

Is it possible to edit this formula and make it reference "CurrentMonthSales" easily?

 

I know that I can find and replace but i dont trust it changing another reference somewhere else in the sheet.

 

I edit this quite a lot and find myself having to retype the formula all the time which is time consuming and frustrating.

 

Thank you

1 Reply

@michaelexcelhelpneeded 

=SUMPRODUCT(((INDIRECT("'" & G1 & "'!" & H1 &":"& I1)="big")+(INDIRECT("'" & G1 & "'!" & H1 &":"& I1)="medium"))*INDIRECT("'" & G1 & "'!" & H2 &":"& I2))

Is this what you are looking for? Instead of adding two SUMIF formulas you can apply SUMPRODUCT and dynamically refer to different sheets and different criteria columns and result columns as well. You have to enter the sheetname in cell G1 and the columns (or ranges) in cells H1, I1, H2 and I2.