Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
DiscussionsAccessExcelInfoPathOutlookPowerPointPublisherWord
DirectoryUser Groups
Related Topics
Outlook ExpressInternet ExplorerWindowsMS Server ProductsMore Topics ...

MS Office Forum / Excel / Worksheet Functions / November 2005

Tip: Looking for answers? Try searching our database.

Trim Function

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Matt M HMS - 21 Nov 2005 21:35 GMT
Hello and thanks in advance -

I have a column of room numbers with [alphas] mixed in as seen below.

A          
100
101D
103F
104  
1004E

Note that the numeric values are sometimes in the thousand range. I need to
create a column B where the numeric value of the room number will be split up
from column C, the alpha, as below;

A          B           C
100      100        
101D    101         D
103F    103         F
104      104  
1004E   1004       E

Matt
Lotus123 - 21 Nov 2005 22:20 GMT
Assuming the Alpha is always one character and always either absent or
located on the right...here you go:

If you value is in Column A, place this in ColumnB (strip the digits):
+VALUE(IF(ISNUMBER(A1),A1,LEFT(A1,LEN(A1)-1)))

Place this in Column C (snag the character):
+IF(ISNUMBER(A1),"",RIGHT(A1,1))

This can be modified even more for situations in which the letter
appears at the beginning or if there are two letters; however, I didn't
want to make the forumla unduely complicated on the first run.

Signature

Lotus123

Dave Breitenbach - 21 Nov 2005 22:35 GMT
If there is always only one letter as the alpha, then the following formulas
will work:
[b1]=IF(ISNUMBER(A1),A1,LEFT(A1,LEN(A1)-1))
[c1]=IF(ISNUMBER(A1),"",RIGHT(A1,1))

However, if any of your values have spaces at the end, then the data will
have to be trimmed first - simply trim(a1) and then adjust the other formulas
to link to the trimmed version of the data column.

If the alpha can be more than one character then it can probably still be
done but more info will be needed on the rules that the alphas follow...i.e
when is there more than one character, etc.

hth,
Dave

> Hello and thanks in advance -
>
[quoted text clipped - 19 lines]
>
> Matt
Bob Phillips - 21 Nov 2005 22:37 GMT
In B1, use

=LEFT(A1,MIN(IF(ISERROR(1*(MID(A1,ROW(INDIRECT("A1:A"&LEN(A1))),1))),ROW(IND
IRECT("A1:A"&LEN(A1))),255))-1)

which is an array formula, so commit with Ctrl-Shift-Enter

In C1,

=SUBSTITUTE(A1,B1,"")

and copy doen

Signature

HTH

RP
(remove nothere from the email address if mailing direct)

> Hello and thanks in advance -
>
[quoted text clipped - 19 lines]
>
> Matt
Bob Phillips - 21 Nov 2005 22:46 GMT
BTW, mine is agnostic to how many letters or numbers are in the string, even
0

Signature

HTH

RP
(remove nothere from the email address if mailing direct)

> In B1, use

=LEFT(A1,MIN(IF(ISERROR(1*(MID(A1,ROW(INDIRECT("A1:A"&LEN(A1))),1))),ROW(IND
> IRECT("A1:A"&LEN(A1))),255))-1)
>
[quoted text clipped - 31 lines]
> >
> > Matt
Peo Sjoblom - 21 Nov 2005 22:42 GMT
=SUBSTITUTE(A2,C,"")

assuming you have the valuse in C, if you want to get the numbers without
using column C

=IF(ISERR(--(A1)),LEFT(A1,MATCH(FALSE,ISNUMBER(--MID(A1,ROW(INDIRECT("1:"&LE
N(A1))),1)),0)-1),A1)

entered with ctrl + shift & enter

assuming all numbers are to the left of the letter

Signature

Regards,

Peo Sjoblom

> Hello and thanks in advance -
>
[quoted text clipped - 19 lines]
>
> Matt
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2009 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.