ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Stripping Spaces from Right Hand Side (https://www.excelbanter.com/excel-programming/427497-stripping-spaces-right-hand-side.html)

Tim Childs[_3_]

Stripping Spaces from Right Hand Side
 
Hi

I have tables of data from a financial system where the non-numeric raw data
is filled with spaces when supplied to me. I am using a loop to test each
cell for these "filler spaces" on the right hand end of each cell and then
applying RTRIM to get the valid text.

Is there a shortcut alternative to using the looping - it seems quite slow

Thanks

Tim


RB Smissaert

Stripping Spaces from Right Hand Side
 
1. Can your SQL handle that right-trim? Might be faster.
2. Do a right trim without testing first.
3. Put the whole range in an array and do the right-trimming on the array
elements then put back in the range.
4. Use RTrim$ instead of RTrim as it is up to twice as fast.

RBS


"Tim Childs" wrote in message
...
Hi

I have tables of data from a financial system where the non-numeric raw
data is filled with spaces when supplied to me. I am using a loop to test
each cell for these "filler spaces" on the right hand end of each cell and
then applying RTRIM to get the valid text.

Is there a shortcut alternative to using the looping - it seems quite slow

Thanks

Tim



Tim Childs[_3_]

Stripping Spaces from Right Hand Side
 
Hi

Many thanks for those suggestions

Out of interest, can you say why in "4." RTrim$ is so much quicker?

Best wishes

Tim

"RB Smissaert" wrote in message
...
1. Can your SQL handle that right-trim? Might be faster.
2. Do a right trim without testing first.
3. Put the whole range in an array and do the right-trimming on the array
elements then put back in the range.
4. Use RTrim$ instead of RTrim as it is up to twice as fast.

RBS


"Tim Childs" wrote in message
...
Hi

I have tables of data from a financial system where the non-numeric raw
data is filled with spaces when supplied to me. I am using a loop to test
each cell for these "filler spaces" on the right hand end of each cell
and then applying RTRIM to get the valid text.

Is there a shortcut alternative to using the looping - it seems quite
slow

Thanks

Tim




RB Smissaert

Stripping Spaces from Right Hand Side
 
Look at this:
http://www.aivosto.com/vbtips/stringopt.html

RBS


"Tim Childs" wrote in message
...
Hi

Many thanks for those suggestions

Out of interest, can you say why in "4." RTrim$ is so much quicker?

Best wishes

Tim

"RB Smissaert" wrote in message
...
1. Can your SQL handle that right-trim? Might be faster.
2. Do a right trim without testing first.
3. Put the whole range in an array and do the right-trimming on the array
elements then put back in the range.
4. Use RTrim$ instead of RTrim as it is up to twice as fast.

RBS


"Tim Childs" wrote in message
...
Hi

I have tables of data from a financial system where the non-numeric raw
data is filled with spaces when supplied to me. I am using a loop to
test each cell for these "filler spaces" on the right hand end of each
cell and then applying RTRIM to get the valid text.

Is there a shortcut alternative to using the looping - it seems quite
slow

Thanks

Tim






All times are GMT +1. The time now is 11:55 PM.

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