R
Raymond Zeitler
I'm trying to compare the displayed value of two formatted cells. The
idea is to detect the equality between 1.2345 and 1.23 when the format
is "#.##" without resorting to VBA. This is Excel 2000, SP3.
So I decided that this might work (may be wrapped):
=IF(TEXT(A1,CELL("format",A1))=TEXT(B1,CELL("format",B1)),"equal","unequal")
Unfortunately, CELL("format",A1) returns "F2", which is incompatible
with the format string required by the TEXT() worksheet function. The
above conditional actually evaluates to "equal" --
TEXT(A1,CELL("format",A1)) and
TEXT(B1,CELL("format",B1)) both evaluate to "F2". Is this silly or
what?
So I came up with this rickety workaround (probably wrapped):
=IF(FIXED(A1,MID(CELL("format",A1),2,99))=FIXED(B1,MID(CELL("format",B1),2,99)),"equal","unequal")
I use MID() to return the number that CELL("format") returns after the
"F", although I can't believe I have to resort to this. Isn't there a
better way?
-----------------
While I'm B&M'ing, entering/editing a formula in the Conditional
Formatting FormulaIs TextBox is enough to drive anyone crazy. Why
isn't there a Build button so that arrow keys don't return a cell
reference?
idea is to detect the equality between 1.2345 and 1.23 when the format
is "#.##" without resorting to VBA. This is Excel 2000, SP3.
So I decided that this might work (may be wrapped):
=IF(TEXT(A1,CELL("format",A1))=TEXT(B1,CELL("format",B1)),"equal","unequal")
Unfortunately, CELL("format",A1) returns "F2", which is incompatible
with the format string required by the TEXT() worksheet function. The
above conditional actually evaluates to "equal" --
TEXT(A1,CELL("format",A1)) and
TEXT(B1,CELL("format",B1)) both evaluate to "F2". Is this silly or
what?
So I came up with this rickety workaround (probably wrapped):
=IF(FIXED(A1,MID(CELL("format",A1),2,99))=FIXED(B1,MID(CELL("format",B1),2,99)),"equal","unequal")
I use MID() to return the number that CELL("format") returns after the
"F", although I can't believe I have to resort to this. Isn't there a
better way?
-----------------
While I'm B&M'ing, entering/editing a formula in the Conditional
Formatting FormulaIs TextBox is enough to drive anyone crazy. Why
isn't there a Build button so that arrow keys don't return a cell
reference?