View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.misc
GS[_6_] GS[_6_] is offline
external usenet poster
 
Posts: 1,182
Default Stripping out text?

I have entries in col G, formatted as General, containing text like the
following. (They represent the sizes of files. Only GB or MB. Always
three digits.)

Col G (text)
-------
3.40 GB
3.82 GB
22.8 MB


I want to place a formula or function or macro in col H which converts
col G to GB. (So that I can subsequently do addition on selected cells,
working only in GB.)

Col H (GB, numbers to 3 dp)
------
3.400
3.820
0.023

Struggling here, particularly with stripping out the GB or MP suffices,
so would much appreciate some help please.

Terry, East Grinstead, UK


How about using a helper col (set to display to 3 dec places) that converts the
numeric value conditional on IF the RIGHT 2 chars are "GB" then extract the
LEFT 4 chars, ELSE divide the LEFT 4 chars by 10K...

=IF(RIGHT($A1,2)="GB",LEFT($A1,4)/1,LEFT($A1,4)/1000)

--
Garry

Free usenet access at http://www.eternal-september.org
Classic VB Users Regroup!
comp.lang.basic.visual.misc
microsoft.public.vb.general.discussion