I want to use the current cell value in a formula. Let’s say i have cell A1, and if is this cell is not blank, the do some operations, else the value should remain:
=IF(ISBLANK(A1), sg, A1)
However, this results an error: circular reference detected. How can i avoid this?
The formula “=IF(ISBLANK(A1), sg, A1)” follows this format =IF(test, test is true_value, test is false_value), so in your case if cell A1 is blank (ie contains the null string “”) your test result is TRUE and your formula will return (sg).
If your formula is contained in cell A1, a “error: Circular dependency detected” will always be generated, this causes an infinite loop that cant be resolved, your testing an expression that relies on the value generated by the test. If the cell A1 references the cell containing your formula you will also get the “error: Circular dependency detected” generated. Also cell A1 cannot ever be blank and contain your formula, the situation is mutually exclusive.
If (sg) is returned your formula assumes that (sg) is a reference to the first value contained in a named range labelled sg, if (sg) is a text string you want to appear in the formula cell if A1 is blank, then it needs to be in quotation marks ie =IF(ISBLANK(A1), “sg”, A1).
You could put your test in your “some other operations” in a cell that is not referenced by or dependant on the value generated by your “some other operations”
Assume cell Z50 is outside of the references and dependencies that Cell A1’s value depends on, and it contains one of your “some other operations”
Cell Z50 formula……=IF(A1=””,””,ROUNDDOWN(A1, 1)
Cell A1 value………….Blank or “”…………………….15.2576536…………………………106.93244
Cell Z50 result………TRUE, output=…………..FALSE, output=15.2……………….FALSE, output=106.9