I have a data download from SAP. The format the data comes into excel is with 8 spaces then the data. I would like to trim the 8 spaces to only 4. Is there a function like Trim() but that only trims a selected amount of spaces?
I have a data download from SAP. The format the data comes into excel is with 8 spaces then the data. I would like to trim the 8 spaces to only 4. Is there a function like Trim() but that only trims a selected amount of spaces?
You could do something like
=right(A1,len(A1)-4)
or
cheers![]()
Please Login or Register to view this content.
or
=rept(" ",4)&trim(a1)
Last edited by martindwilson; 07-19-2010 at 06:54 PM.
"Unless otherwise stated all my comments are directed at OP"
Mojito connoisseur and now happily retired
where does code go ?
look here
how to insert code
how to enter array formula
why use -- in sumproduct
recommended reading
wiki Mojito
how to say no convincingly
most important thing you need
Martin Wilson: SPV
and RSMBC
Try this
![]()
Please Login or Register to view this content.
Or more precisely
![]()
Please Login or Register to view this content.
N.B.
Char(32) = "Space "
Hope this helps
Last edited by Marcol; 07-19-2010 at 07:02 PM.
If you need any more information, please feel free to ask.
However,If this takes care of your needs, please select Thread Tools from menu above and set this topic to SOLVED. It helps everybody! ....
Also
اس کی مدد کرتا ہے اگر
شکریہ کہنے کے لئے سٹار کلک کریں
If you are satisfied by any members response to your problem please consider using the small Star icon bottom left of their post to show your appreciation.
=SUBSTITUTE(TRIM(A1)," ",REPT(" ",4)) wont work as once trimmed a1 has no spaces
but here,s another
=REPLACE(A1,1,4,"")
Last edited by martindwilson; 07-19-2010 at 07:05 PM.
Hmm .... martindwilson
I disagree, seems to work for me.
The second alternative is less error prone.
[EDIT]
Might be the difference between Trim in Excel and VBa
VBa removes leading and trailing spaces
Excel Formula removes all excess spaces
Last edited by Marcol; 07-19-2010 at 07:17 PM.
wanna bet? lol
Hi martin
I re-read the question and you are correct, I assumed the spaces were within the string.
My apologies......
Why should anyone want leading spaces?.....![]()
......................................................................ah now there's a thing! oops blast those spaces lol
Thanks for the responses all. I dont would rather not have the leading spaces, but don't want to rebuild the whole model that someone else have created either.
There are currently 1 users browsing this thread. (0 members and 1 guests)
Bookmarks