Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Use Resulting Value of One Formula Multiple Times In Cell

I am not really sure how to explain it, I am trying to run one formula to search for information and use the result multiple times in a single cell. I am currently doing this to display the queried value AND then running the same formula to find the average also.

Example Formula (Simplified)

=<FormulaToFindValue> & " (" & Round(<FormulaToFindValue>/I52,2) & "/day)"

Acutal Formula

=SUMPRODUCT((MONTH('W.A.R. 2016'!$A4:$A369)>=7)*(MONTH('W.A.R. 2016'!$A4:$A369)<=9)*('W.A.R. 2016'!$A4:$A369<TODAY())*('W.A.R. 2016'!Q4:Q369))  & " (~" & IFERROR(ROUND(SUMPRODUCT((MONTH('W.A.R. 2016'!$A4:$A369)>=7)*(MONTH('W.A.R. 2016'!$A4:$A369)<=9)*('W.A.R. 2016'!$A4:$A369<TODAY())*('W.A.R. 2016'!Q4:Q369))/B18,2),0) & "/day)"

As you can see I have to use the same Formula two times in the same cell to get the result I want, is there a way to only run the Formula once and use the resulting value multiple times? Usually this would be done by storing the value in a variable but I can't don't see similar capability in excel.

like image 245
Nick W. Avatar asked Oct 29 '22 20:10

Nick W.


1 Answers

Put the formula in a name (be careful to pick your relevant choice between fixed and dynamic references to the input ranges). Now that name can be used multiple times in a cell or in the workbook. In the example below the formula is the sum of the product between two fixed ranges and a nonsense formula in the shown cell uses this formula twice:

enter image description here

like image 130
Mats Lind Avatar answered Nov 15 '22 07:11

Mats Lind