Hi
Harlan Grove said:
Arvi Laanemets wrote...
...
Yes, but it's a meaningless conversion *EXCEPT* for blank cells. Put 0
(number) in A1 and ="0" (numeric string) in A2. Make sure cell IV65536
is blank. Then enter the formulas
=COUNTIF(A1:A2,0)
=COUNTIF(A1:A2,"0")
=COUNTIF(A1:A2,IV65536)
Do they all return 2? On the other hand, the formula
=COUNTIF(A1:A2,IV65536&"")
should return 0.
COUNTIF's (and SUMIF's) second argument is always interpreted as a
string, BUT it appears this is only done inside the COUNTIF (and SUMIF)
functions. Excel passes these functions the second argument, but it
appears Excel converts blank cells in the second argument into numeric
zeros. This really looks like a bug that's become a 'feature' since
LEN(IV65536) returns 0 rather than 1, so there *ARE* Excel functions
that treat blank cell arguments as "" rather than 0, but the Excel
developers seem not to have applied the same type handling of COUNTIF's
(and SUMIF's) second argument as they did for LEN's argument. Want to
start a pool on how many years it'll take Microsoft to fix this?
OK. Because the formula in state it was presented (countifM4,A1:A10&"")
didn't have any meaning, I missed that it had to be something based on
COUNTIF. So my post was about formulas in general. A couple of examples with
VLOOKUP here
A1:A3 contains numbers (format General) 1, 2, 3
B1:B3 contains charctes "A", "B", "C"
C1 (Text) contains numeric string "2"
The formula
=VLOOKUP(C1,A2:B3,2,0)
(as regular one so array formula) returns "#N/A"
{=VLOOKUP(C1,(A2:B3)&"",2,0)}
returna "B"
The same setup, but A1:A3 is formatted as Text, and C1 as General (all
values re-entered of-course)
=VLOOKUP(C1,A2:B3,2,0)
returns "#N/A" again
=VLOOKUP(C1&"",A2:B3,2,0)
(regular formula) returns "B"
Those above are of-course simplified examples. With single-type direct
entries you can avoid such problems. But sometimes those numeric strings are
results of some formulas, i.e. you can't format the cell as text. And some
entries are there texts, and some numeric strings - even when you force the
result to be string (MyFormula&""), and it behaves as string (without
alignment is left-aligned), in references it is sometimes interpreted as
number.
Arvi Laanemets