View Single Post
  #4   Report Post  
Posted to microsoft.public.excel.worksheet.functions
Roger Govier
 
Posts: n/a
Default How do you trim characters?

Hi Tommi

With the value containing the string try
=MID(A1,3,2)
The 3 tells the Mid function to start at the 3rd character position
The 2 tells it to take 2 characters.

If you want the resulting 11 to be numeric instead of text, then precede
the formula with the double unary minus -- which will coerce the text
value to a number
=--MID(A1,3,2)

--
Regards

Roger Govier


"Tommi" wrote in
message ...

Hi there!

This is my first post, so please have mercy on my soul.

In one cell I have a character string, e.g. 1011-1

I want to extract the 3rd and 4th character to a new cell, i.e. "11"
above, as a number.

I was thinking of using a trim-type function to remove the first two
characters and everything after (and including) the hypen. Problem:
the
trim function seems to only remove spaces.

I'd like to do this in the little fx window rather than using anything
fancy like VBA.

Thanks for any help you can provide. :)


--
Tommi
------------------------------------------------------------------------
Tommi's Profile:
http://www.excelforum.com/member.php...o&userid=30942
View this thread:
http://www.excelforum.com/showthread...hreadid=506143