Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 76
Default Coverting strings to numbers and trimming trailing zeros

I'm reading your comment as replacing a "." with a ".", hence I don't
understand how that helps...I've done what you have mentioned, but I
have the original results.

On Feb 1, 11:27*am, Dave Peterson wrote:
Try formatting the range as General
Then edit|replace
what: *. *(decimal point)
with: *.
replace all

Record a macro when you do it in code and you should be ok.





S Himmelrich wrote:

Basically, I've tried to format the cell in a macro and as it's a
string it's not reformatting so this is the case I'm trying to
resolve . . .


My original data looks like this:


151.00
1.00
2.25
16.00
16.20


I'm looking for a result like this""
151
1
2.25
16
16.2


--

Dave Peterson- Hide quoted text -

- Show quoted text -


  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 35,218
Default Coverting strings to numbers and trimming trailing zeros

And you did change the numberformat to General first, right?

If yes, then changing the dot to dot will make excel reevalate the stuff in each
cell. If they're really numbers, then excel will see them as numbers. And with
a general format, the trailing .00 won't show.

But it sounds like your values aren't really digits (and dots).

If you got the data from a web page, then you may have HTML non-breaking spaces
in your data.

David McRitchie has a macro that can help clean this:
http://www.mvps.org/dmcritchie/excel/join.htm#trimall
(look for "Sub Trimall()")

And if you're new to macros, you may want to read David's intro:
http://www.mvps.org/dmcritchie/excel/getstarted.htm


S Himmelrich wrote:

I'm reading your comment as replacing a "." with a ".", hence I don't
understand how that helps...I've done what you have mentioned, but I
have the original results.

On Feb 1, 11:27 am, Dave Peterson wrote:
Try formatting the range as General
Then edit|replace
what: . (decimal point)
with: .
replace all

Record a macro when you do it in code and you should be ok.





S Himmelrich wrote:

Basically, I've tried to format the cell in a macro and as it's a
string it's not reformatting so this is the case I'm trying to
resolve . . .


My original data looks like this:


151.00
1.00
2.25
16.00
16.20


I'm looking for a result like this""
151
1
2.25
16
16.2


--

Dave Peterson- Hide quoted text -

- Show quoted text -


--

Dave Peterson
  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 76
Default Coverting strings to numbers and trimming trailing zeros

Talk about tricks of the trade...thank you much.

On Feb 1, 12:22*pm, Dave Peterson wrote:
And you did change the numberformat to General first, right?

If yes, then changing the dot to dot will make excel reevalate the stuff in each
cell. *If they're really numbers, then excel will see them as numbers. *And with
a general format, the trailing .00 won't show.

But it sounds like your values aren't really digits (and dots).

If you got the data from a web page, then you may have HTML non-breaking spaces
in your data.

David McRitchie has a macro that can help clean this:http://www.mvps.org/dmcritchie/excel/join.htm#trimall
(look for "Sub Trimall()")

And if you're new to macros, you may want to read David's intro:http://www..mvps.org/dmcritchie/excel/getstarted.htm





S Himmelrich wrote:

I'm reading your comment as replacing a "." with a ".", hence I don't
understand how that helps...I've done what you have mentioned, but I
have the original results.


On Feb 1, 11:27 am, Dave Peterson wrote:
Try formatting the range as General
Then edit|replace
what: *. *(decimal point)
with: *.
replace all


Record a macro when you do it in code and you should be ok.


S Himmelrich wrote:


Basically, I've tried to format the cell in a macro and as it's a
string it's not reformatting so this is the case I'm trying to
resolve . . .


My original data looks like this:


151.00
1.00
2.25
16.00
16.20


I'm looking for a result like this""
151
1
2.25
16
16.2


--


Dave Peterson- Hide quoted text -


- Show quoted text -


--

Dave Peterson- Hide quoted text -

- Show quoted text -


Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Trailing zeros Gatz Excel Worksheet Functions 5 April 30th 09 08:34 PM
Trailing Zeros aftamath77 Excel Discussion (Misc queries) 3 October 7th 08 07:40 PM
Import decimal numbers with trailing zeros into Excel JackCali Excel Programming 1 March 2nd 07 07:06 PM
Keep numbers as entered with trailing zeros Allie Excel Discussion (Misc queries) 2 August 3rd 06 06:39 PM
Trailing zeros are dropping off mjd918 Excel Programming 0 October 18th 04 09:27 PM


All times are GMT +1. The time now is 09:28 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"