I like to keep my Excel spreadsheets fairly clean. So, often times I'll end up writing statements like this:
IF([formula x]=[value],"",[formula x])
What that essentially says is that if the formula matches a given criteria, do not display the result - otherwise, display the result.
In some cases, [formula x] is repeated down an entire column of cells and each cell has a reference in [formula x] that points to the cell above it. To avoid formula errors, I have to add another layer like so:
IF(C2="","",IF([formula x]=[value],"",[formula x])
However, especially when [formula x] is very long, this can result in an end formula that looks much more complicated than it is and becomes much harder to troubleshoot and maintain than it should be.
Here's one horrific example...
Base formula:
=IF(A3>=$E$11,C2+(C2*($F$2/12))-$E$9,C2+(C2*($F$2/12))-$E$7)
Add conditional blanking:
=IF(C2="","",IF(IF(A3>=$E$11,C2+(C2*($F$2/12)-$E$9),C2+(C2*($F$2/12))-$E$7)<=0,"",IF(A3>=$E$11,C2+(C2*($F$2/12))-$E$9,C2+(C2*($F$2/12))-$E$7)))
An already very long formula is more than doubled in size, just so that I can display a blank (or any other chosen value, for that matter) when that same formula meets a given condition. If I try to do this across an entire row, depending on the starting formula, I could easily run into circular reference errors.
Is there any way to self-reference an existing formula or argument within the same cell, or maybe another function or feature that can be used to achieve this result more cleanly?
A function that does what I'm looking for might be like this:
=FnName([base formula],[match condition],[condition result])
Argument 1 is the base formula, argument 2 is the condition I'm interested in matching. Argument 3 is the result to display if the condition matches. In the case the condition is not matched, the function returns the result of the base formula.