ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Worksheet Functions (https://www.excelbanter.com/excel-worksheet-functions/)
-   -   formula to analize info in a cell (https://www.excelbanter.com/excel-worksheet-functions/27602-formula-analize-info-cell.html)

Jordan

formula to analize info in a cell
 
I have a cell that has a mix a text and numbers. I need to know how many of
the charaters are text and how many are numbers. It usually is something
like JDR89765 or JD5674, meaning that the text is on the left side. If
possible I would like to read from left to right and get a count of how many
text char there are before the first number.

Any help will be greatly appreciated.

Thanks in advance.

N Harkawat

=LEN(A1)-SUMPRODUCT(--ISNUMBER(-RIGHT(A1,ROW(INDIRECT("1:"&LEN(A1)))))

will tell you the number of text characters in the cell


"Jordan" wrote in message
...
I have a cell that has a mix a text and numbers. I need to know how many
of
the charaters are text and how many are numbers. It usually is something
like JDR89765 or JD5674, meaning that the text is on the left side. If
possible I would like to read from left to right and get a count of how
many
text char there are before the first number.

Any help will be greatly appreciated.

Thanks in advance.




Peo Sjoblom

One way, assume the string is in A1

=MATCH(TRUE,ISNUMBER(--MID(A1,ROW(INDIRECT("1:"&LEN(A1)))+1,1)),0)

entered with ctrl + shift & enter,

and to get the number of of numbers just use the cell result, assume you put
that formula in B1, in C use

=LEN(A1)-B1

note that if there are spaces they will be counted so you could wrap each
cell refof in the cell with TRIM


=MATCH(TRUE,ISNUMBER(--MID(TRIM(A1),ROW(INDIRECT("1:"&LEN(TRIM(A1))))+1,1 )),0)

then

=TRIM(LEN(A1)-B1 for the numbers


Regards,

Peo Sjoblom

"Jordan" wrote:

I have a cell that has a mix a text and numbers. I need to know how many of
the charaters are text and how many are numbers. It usually is something
like JDR89765 or JD5674, meaning that the text is on the left side. If
possible I would like to read from left to right and get a count of how many
text char there are before the first number.

Any help will be greatly appreciated.

Thanks in advance.


Harlan Grove

N Harkawat wrote:
=LEN(A1)-SUMPRODUCT(--ISNUMBER(-RIGHT(A1,ROW(INDIRECT("1:"&LEN(A1)))))

will tell you the number of text characters in the cell

....

Not reliably. If A1 contained JDR89765X, your formula returns 9 rather
than 4.

An alternative that works no matter how decimal numerals and other
characters are scrambled is

=SUMPRODUCT(LEN(SUBSTITUTE(G2,{0;1;2;3;4;5;6;7;8;9 },"")))-9*LEN(G2)



All times are GMT +1. The time now is 10:12 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com