"T" function broken?
On Tue, 14 Jul 2009 17:34:41 -0400, Ron Rosenfeld wrote:
On Tue, 14 Jul 2009 14:23:36 -0600, salgud wrote:
I've been trying different text functions for a spreadsheet I'm working on.
Came across the "T" function, but can't get it to work. (Isn't this a
terrible name for a function, a single letter?)
If I simply apply it alone, as in =t(B7) in cell C7, it seems to behave as
described. If B7 is alpha, T returns the alpha string. It B7 is a number,
it returns a blank. Ok.
But if I put a LEFT function inside it to use it to determine if the
leftmost character in a string is alpha or numeric, it goes kablooie!
I.e., I put =T(LEFT(B7,1)) in Cell C7. If I put abc in cell B7, it returns
the "a". Great. but if I put 222 in cell B7, it returns a 2! It should be
blank since the 2 is numeric. So why does it return 2?
Actually, the "2" that is returned by the LEFT worksheet function is a text
string. So T, seeing text, returns it as designed.
You can perhaps see the difference by looking at the results of the following:
=t(222)
=t("222")
I was going to wrap an IF statement around all this to determine if a
string starts with a alpha or a numeric character, but this obviously wont'
work.
There are several ways to tell if a string starts with a number or not:
=ISNUMBER(-LEFT(B7,1))
is one way. Again, you have to bear in mind that LEFT returns a text string.
Prepending it with a "-" will result in either a number, or an error.
--ron
Thanks for the reply. Explains the behavior of the T function. Never heard
of a -Left function before. What other functions can you do that with
(besides RIGHT)?
|