ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Worksheet Functions (https://www.excelbanter.com/excel-worksheet-functions/)
-   -   Numbers after specific text (https://www.excelbanter.com/excel-worksheet-functions/77040-numbers-after-specific-text.html)

Steve

Numbers after specific text
 
The following data is entered in a cell:

P5-MPC FT 18, P5-MPC FT 25, P5-MPC FT 30, P5-MPC FT 35,P5-MPC PTR 1, P5-MPC
PTF 9

The P5-MPC text is irrelevent. I need the #'s after each FT, after each PTR
and after each PTF, so that my resulting data would be:

FT18
FT25
FT30
FT35
PTR1
PTF1

Could the above be returned in 6 different cells even if the original data
is all in one cell?
Ultimately I need to count all the FTs, all the PTRs, & all the PTFs.(
FT=4,PTR=1, PTF=1)

Any help would be greatly appreciated.

Thanks,

Steve

Arvi Laanemets

Numbers after specific text
 
Hi

Select the range with strings. Select Replace from Edit menu, into SearchFor
field enter "P5-MPC ", into ReplaceWith field enter nothing, and click on
ReplaceAll button.

Be sure you have enough additional free columns to right of column with
strings (for your example string 5 free columns are needed. With range
containing strings
selected, activate from Data menu TextToColumns wizard. Select comma as
delimiter, and proceed.

There you are!


Arvi Laanemets



"Steve" wrote in message
...
The following data is entered in a cell:

P5-MPC FT 18, P5-MPC FT 25, P5-MPC FT 30, P5-MPC FT 35,P5-MPC PTR 1,

P5-MPC
PTF 9

The P5-MPC text is irrelevent. I need the #'s after each FT, after each

PTR
and after each PTF, so that my resulting data would be:

FT18
FT25
FT30
FT35
PTR1
PTF1

Could the above be returned in 6 different cells even if the original data
is all in one cell?
Ultimately I need to count all the FTs, all the PTRs, & all the PTFs.(
FT=4,PTR=1, PTF=1)

Any help would be greatly appreciated.

Thanks,

Steve




Biff

Numbers after specific text
 
Hi!

Try these:

For FT:

=(LEN(A1)-LEN(SUBSTITUTE(A1," FT ","")))/LEN(" FT ")

For PTR:

=(LEN(A1)-LEN(SUBSTITUTE(A1," PTR ","")))/LEN(" PTR ")

For PTF:

=(LEN(A1)-LEN(SUBSTITUTE(A1," PTF ","")))/LEN(" PTF ")

Biff

"Steve" wrote in message
...
The following data is entered in a cell:

P5-MPC FT 18, P5-MPC FT 25, P5-MPC FT 30, P5-MPC FT 35,P5-MPC PTR 1,
P5-MPC
PTF 9

The P5-MPC text is irrelevent. I need the #'s after each FT, after each
PTR
and after each PTF, so that my resulting data would be:

FT18
FT25
FT30
FT35
PTR1
PTF1

Could the above be returned in 6 different cells even if the original data
is all in one cell?
Ultimately I need to count all the FTs, all the PTRs, & all the PTFs.(
FT=4,PTR=1, PTF=1)

Any help would be greatly appreciated.

Thanks,

Steve




Harlan Grove

Numbers after specific text
 
Steve wrote...
The following data is entered in a cell:

P5-MPC FT 18, P5-MPC FT 25, P5-MPC FT 30, P5-MPC FT 35,P5-MPC PTR 1,
P5-MPC PTF 9

The P5-MPC text is irrelevent. I need the #'s after each FT, after each PTR
and after each PTF, so that my resulting data would be:

FT18
FT25
FT30
FT35
PTR1
PTF1

Could the above be returned in 6 different cells even if the original data
is all in one cell?

....

The easiest way to do this uses two cells per result. With your string
in cell A1 and the first result in cell D3, try these formulas.

C3:
=MIN(FIND({" FT";" PTR";" PTF"},A1&" FT PTR PTF"))+1

D3:
=MID(A$1,C3,FIND(",",A$1&",",C3)-C3)

C4:
=MIN(FIND({" FT";" PTR";" PTF"},A$1&" FT PTR PTF",C3+LEN(D3)))+1

D4:
=MID(A$1,C4,FIND(",",A$1&",",C4)-C4)

Select C4:D4 and fill down as far as needed, in this case through C8:D8.


Ron Rosenfeld

Numbers after specific text
 
On Mon, 13 Mar 2006 11:14:53 -0800, Steve
wrote:

The following data is entered in a cell:

P5-MPC FT 18, P5-MPC FT 25, P5-MPC FT 30, P5-MPC FT 35,P5-MPC PTR 1, P5-MPC
PTF 9

The P5-MPC text is irrelevent. I need the #'s after each FT, after each PTR
and after each PTF, so that my resulting data would be:

FT18
FT25
FT30
FT35
PTR1
PTF1

Could the above be returned in 6 different cells even if the original data
is all in one cell?
Ultimately I need to count all the FTs, all the PTRs, & all the PTFs.(
FT=4,PTR=1, PTF=1)

Any help would be greatly appreciated.

Thanks,

Steve


To count the number of text strings, you can use the SUBSTITUTE function:

If your string is in A1, and B1 contains what you want to count (e.g. FT),
then:

=(LEN($A$1)-LEN(SUBSTITUTE($A$1,B1,"")))/LEN(B1)

will give you the number of FT's.


--ron

Steve

Numbers after specific text
 
Thanks all. I really appreciate the responses.

I'm on another project, so I won't be able to try the suggestions until
later in the week, but will get back with the results.

Thanks again,

Steve

"Steve" wrote:

The following data is entered in a cell:

P5-MPC FT 18, P5-MPC FT 25, P5-MPC FT 30, P5-MPC FT 35,P5-MPC PTR 1, P5-MPC
PTF 9

The P5-MPC text is irrelevent. I need the #'s after each FT, after each PTR
and after each PTF, so that my resulting data would be:

FT18
FT25
FT30
FT35
PTR1
PTF1

Could the above be returned in 6 different cells even if the original data
is all in one cell?
Ultimately I need to count all the FTs, all the PTRs, & all the PTFs.(
FT=4,PTR=1, PTF=1)

Any help would be greatly appreciated.

Thanks,

Steve



All times are GMT +1. The time now is 01:27 AM.

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