Get part of text in a Cell

S

Stan Brown

Tue, 11 Mar 2008 03:58:02 -0700 from Marcha
I don't know how to search for this Function - but I'm sure I have seen it.

I have a text-cell - and in that cell I want to retrieve a 'Code' that is
placed within the cell. The 'Code' is between a [ and ] - like: [OT] 1 june.
I want the [OT] to be written in another cell in the row. (Don't wanna
remove it from the current cell - just copy it)
I know I can get the posistion with FIND("[";F6) and FIND("]";F6)
Now I just want to place it in J6 - something like: GetText(F6;1;3) - and
the result would be [OT] in the cell F6 :D

The function you want is called MID( ).
 
M

Marcha

I don't know how to search for this Function - but I'm sure I have seen it.

I have a text-cell - and in that cell I want to retrieve a 'Code' that is
placed within the cell. The 'Code' is between a [ and ] - like: [OT] 1 june.
I want the [OT] to be written in another cell in the row. (Don't wanna
remove it from the current cell - just copy it)
I know I can get the posistion with FIND("[";F6) and FIND("]";F6)
Now I just want to place it in J6 - something like: GetText(F6;1;3) - and
the result would be [OT] in the cell F6 :D

Thank you for easing a lot of minds :)
 
P

Pete_UK

Put this formula in J6:

=MID(F6,FIND("[",F6),FIND("]",F6)-FIND("[",F6)+1)

Hope this helps.

Pete
 
F

FSt1

hi
yes you have seen it. look up the =left(), =right() and =mid() functions in
xl help.
i think that is what your are looking for.

Regards
FSt1
 
M

Marcha

Thank you Pete - very useful (copy/paste)... I just had to change the commas
(,) with simmi collons (;)

Now I would like to get no results if the 'Code' is not there yet - if the
Member is new... There comes a #Value in Cell - and want nothing - just
blank. Is that possible?



Pete_UK said:
Put this formula in J6:

=MID(F6,FIND("[",F6),FIND("]",F6)-FIND("[",F6)+1)

Hope this helps.

Pete

Marcha said:
I don't know how to search for this Function - but I'm sure I have seen it.

I have a text-cell - and in that cell I want to retrieve a 'Code' that is
placed within the cell. The 'Code' is between a [ and ] - like: [OT] 1
june.
I want the [OT] to be written in another cell in the row. (Don't wanna
remove it from the current cell - just copy it)
I know I can get the posistion with FIND("[";F6) and FIND("]";F6)
Now I just want to place it in J6 - something like: GetText(F6;1;3) - and
the result would be [OT] in the cell F6 :D

Thank you for easing a lot of minds :)
 
P

Pete_UK

You can do it like this:

=IF(ISERROR(MID(F6,FIND("[",F6),FIND("]",F6)-FIND("[",F6)+1)),"",MID(F6,FIND("[",F6),FIND("]",F6)-FIND("[",F6)+1))

Hope this helps.

Pete

Marcha said:
Thank you Pete - very useful (copy/paste)... I just had to change the
commas
(,) with simmi collons (;)

Now I would like to get no results if the 'Code' is not there yet - if the
Member is new... There comes a #Value in Cell - and want nothing - just
blank. Is that possible?



Pete_UK said:
Put this formula in J6:

=MID(F6,FIND("[",F6),FIND("]",F6)-FIND("[",F6)+1)

Hope this helps.

Pete

Marcha said:
I don't know how to search for this Function - but I'm sure I have seen
it.

I have a text-cell - and in that cell I want to retrieve a 'Code' that
is
placed within the cell. The 'Code' is between a [ and ] - like: [OT] 1
june.
I want the [OT] to be written in another cell in the row. (Don't wanna
remove it from the current cell - just copy it)
I know I can get the posistion with FIND("[";F6) and FIND("]";F6)
Now I just want to place it in J6 - something like: GetText(F6;1;3) -
and
the result would be [OT] in the cell F6 :D

Thank you for easing a lot of minds :)
 
R

RagDyeR

How about:

=IF(ISNUMBER(FIND("[",F6)),MID(F6,FIND("[",F6),FIND("]",F6)-FIND("[",F6)+1),"")

?

--

Regards,

RD
-----------------------------------------------------------------------------------------------
Please keep all correspondence within the Group, so all may benefit !
-----------------------------------------------------------------------------------------------


You can do it like this:

=IF(ISERROR(MID(F6,FIND("[",F6),FIND("]",F6)-FIND("[",F6)+1)),"",MID(F6,FIND("[",F6),FIND("]",F6)-FIND("[",F6)+1))

Hope this helps.

Pete

Marcha said:
Thank you Pete - very useful (copy/paste)... I just had to change the
commas
(,) with simmi collons (;)

Now I would like to get no results if the 'Code' is not there yet - if the
Member is new... There comes a #Value in Cell - and want nothing - just
blank. Is that possible?



Pete_UK said:
Put this formula in J6:

=MID(F6,FIND("[",F6),FIND("]",F6)-FIND("[",F6)+1)

Hope this helps.

Pete

Marcha said:
I don't know how to search for this Function - but I'm sure I have seen
it.

I have a text-cell - and in that cell I want to retrieve a 'Code' that
is
placed within the cell. The 'Code' is between a [ and ] - like: [OT] 1
june.
I want the [OT] to be written in another cell in the row. (Don't wanna
remove it from the current cell - just copy it)
I know I can get the posistion with FIND("[";F6) and FIND("]";F6)
Now I just want to place it in J6 - something like: GetText(F6;1;3) -
and
the result would be [OT] in the cell F6 :D

Thank you for easing a lot of minds :)
 
P

Pete_UK

Well, you'll also need to look for the closing square bracket because you
might just have one without the other.

Pete

RagDyeR said:
How about:

=IF(ISNUMBER(FIND("[",F6)),MID(F6,FIND("[",F6),FIND("]",F6)-FIND("[",F6)+1),"")

?

--

Regards,

RD
-----------------------------------------------------------------------------------------------
Please keep all correspondence within the Group, so all may benefit !
-----------------------------------------------------------------------------------------------


You can do it like this:

=IF(ISERROR(MID(F6,FIND("[",F6),FIND("]",F6)-FIND("[",F6)+1)),"",MID(F6,FIND("[",F6),FIND("]",F6)-FIND("[",F6)+1))

Hope this helps.

Pete

Marcha said:
Thank you Pete - very useful (copy/paste)... I just had to change the
commas
(,) with simmi collons (;)

Now I would like to get no results if the 'Code' is not there yet - if
the
Member is new... There comes a #Value in Cell - and want nothing - just
blank. Is that possible?



Pete_UK said:
Put this formula in J6:

=MID(F6,FIND("[",F6),FIND("]",F6)-FIND("[",F6)+1)

Hope this helps.

Pete

I don't know how to search for this Function - but I'm sure I have seen
it.

I have a text-cell - and in that cell I want to retrieve a 'Code' that
is
placed within the cell. The 'Code' is between a [ and ] - like: [OT] 1
june.
I want the [OT] to be written in another cell in the row. (Don't wanna
remove it from the current cell - just copy it)
I know I can get the posistion with FIND("[";F6) and FIND("]";F6)
Now I just want to place it in J6 - something like: GetText(F6;1;3) -
and
the result would be [OT] in the cell F6 :D

Thank you for easing a lot of minds :)
 
R

RagDyeR

I kind of doubt that ... but it's up to the OP to mention that.<bg>
--

Regards,

RD
-----------------------------------------------------------------------------------------------
Please keep all correspondence within the Group, so all may benefit !
-----------------------------------------------------------------------------------------------

Well, you'll also need to look for the closing square bracket because you
might just have one without the other.

Pete

RagDyeR said:
How about:

=IF(ISNUMBER(FIND("[",F6)),MID(F6,FIND("[",F6),FIND("]",F6)-FIND("[",F6)+1),"")

?

--

Regards,

RD
-----------------------------------------------------------------------------------------------
Please keep all correspondence within the Group, so all may benefit !
-----------------------------------------------------------------------------------------------


You can do it like this:

=IF(ISERROR(MID(F6,FIND("[",F6),FIND("]",F6)-FIND("[",F6)+1)),"",MID(F6,FIND("[",F6),FIND("]",F6)-FIND("[",F6)+1))

Hope this helps.

Pete

Marcha said:
Thank you Pete - very useful (copy/paste)... I just had to change the
commas
(,) with simmi collons (;)

Now I would like to get no results if the 'Code' is not there yet - if
the
Member is new... There comes a #Value in Cell - and want nothing - just
blank. Is that possible?



Pete_UK said:
Put this formula in J6:

=MID(F6,FIND("[",F6),FIND("]",F6)-FIND("[",F6)+1)

Hope this helps.

Pete

I don't know how to search for this Function - but I'm sure I have seen
it.

I have a text-cell - and in that cell I want to retrieve a 'Code' that
is
placed within the cell. The 'Code' is between a [ and ] - like: [OT] 1
june.
I want the [OT] to be written in another cell in the row. (Don't wanna
remove it from the current cell - just copy it)
I know I can get the posistion with FIND("[";F6) and FIND("]";F6)
Now I just want to place it in J6 - something like: GetText(F6;1;3) -
and
the result would be [OT] in the cell F6 :D

Thank you for easing a lot of minds :)
 
M

Marcha

Thank you so much Pete - Exactly what I wanted :)



Pete_UK said:
You can do it like this:

=IF(ISERROR(MID(F6,FIND("[",F6),FIND("]",F6)-FIND("[",F6)+1)),"",MID(F6,FIND("[",F6),FIND("]",F6)-FIND("[",F6)+1))

Hope this helps.

Pete

Marcha said:
Thank you Pete - very useful (copy/paste)... I just had to change the
commas
(,) with simmi collons (;)

Now I would like to get no results if the 'Code' is not there yet - if the
Member is new... There comes a #Value in Cell - and want nothing - just
blank. Is that possible?



Pete_UK said:
Put this formula in J6:

=MID(F6,FIND("[",F6),FIND("]",F6)-FIND("[",F6)+1)

Hope this helps.

Pete

I don't know how to search for this Function - but I'm sure I have seen
it.

I have a text-cell - and in that cell I want to retrieve a 'Code' that
is
placed within the cell. The 'Code' is between a [ and ] - like: [OT] 1
june.
I want the [OT] to be written in another cell in the row. (Don't wanna
remove it from the current cell - just copy it)
I know I can get the posistion with FIND("[";F6) and FIND("]";F6)
Now I just want to place it in J6 - something like: GetText(F6;1;3) -
and
the result would be [OT] in the cell F6 :D

Thank you for easing a lot of minds :)
 
P

Pete_UK

You're welcome, Marcha - thanks for feeding back.

Pete

Thank you so much Pete - Exactly what I wanted :)



Pete_UK said:
You can do it like this:
=IF(ISERROR(MID(F6,FIND("[",F6),FIND("]",F6)-FIND("[",F6)+1)),"",MID(F6,FIN­D("[",F6),FIND("]",F6)-FIND("[",F6)+1))

Hope this helps.

Marcha said:
Thank you Pete - very useful (copy/paste)... I just had to change the
commas
(,) with simmi collons (;)
Now I would like to get no results if the 'Code' is not there yet - ifthe
Member is new... There comes a #Value in Cell - and want nothing - just
blank. Is that possible?
:
Put this formula in J6:
=MID(F6,FIND("[",F6),FIND("]",F6)-FIND("[",F6)+1)
Hope this helps.
Pete
I don't know how to search for this Function - but I'm sure I have seen
it.
I have a text-cell - and in that cell I want to retrieve a 'Code' that
is
placed within the cell. The 'Code' is between a [ and ] - like: [OT] 1
june.
I want the [OT] to be written in another cell in the row. (Don't wanna
remove it from the current cell - just copy it)
I know I can get the posistion with FIND("[";F6) and FIND("]";F6)
Now I just want to place it in J6 - something like: GetText(F6;1;3)-
and
the result would be [OT] in the cell F6 :D
Thank you for easing a lot of minds :)- Hide quoted text -

- Show quoted text -
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top