ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Discussion (Misc queries) (https://www.excelbanter.com/excel-discussion-misc-queries/)
-   -   Need Help With A Very Simple Macro (https://www.excelbanter.com/excel-discussion-misc-queries/25179-need-help-very-simple-macro.html)

Amca

Need Help With A Very Simple Macro
 
I download from a database that provides ratios in the following format "
0.95 :1" which is formatted as text. I tried to write a macro that would
delete the " :1" so I could convert the cell to a number and use it in
calculations. Every time I run the macro it changes the cell to the exact
number that was in the original cell I used when creating the macro. Does
anyone know what I am doing wrong?

Franz

"Amca" ha scritto nel messaggio


I download from a database that provides ratios in the following
format "
0.95 :1" which is formatted as text. I tried to write a macro that
would delete the " :1" so I could convert the cell to a number and
use it in calculations. Every time I run the macro it changes the
cell to the exact number that was in the original cell I used when
creating the macro. Does anyone know what I am doing wrong?


Instead of using a macro, you can select the range to convert, then menu
Edit, substitute and here in the cell Find put :1 and leave blank the cell
Substitute, then press Ok.


--
Hoping to be helpful...

Regards

Franz

----------------------------------------------------------------------------------------
To reply translate from italian InVento (no capital letters)
----------------------------------------------------------------------------------------



Don Guillett

As always, post your efforts to help us help you

--
Don Guillett
SalesAid Software

"Amca" wrote in message
...
I download from a database that provides ratios in the following format "
0.95 :1" which is formatted as text. I tried to write a macro that would
delete the " :1" so I could convert the cell to a number and use it in
calculations. Every time I run the macro it changes the cell to the exact
number that was in the original cell I used when creating the macro. Does
anyone know what I am doing wrong?




CLR

Assuming your data is in column A, here's a formula you can put in B1 and
copy down to return what you want as a number..........

=(LEFT(A1,FIND(":",A1)-1))*1

Vaya con Dios,
Chuck, CABGx3


"Amca" wrote in message
...
I download from a database that provides ratios in the following format "
0.95 :1" which is formatted as text. I tried to write a macro that would
delete the " :1" so I could convert the cell to a number and use it in
calculations. Every time I run the macro it changes the cell to the exact
number that was in the original cell I used when creating the macro. Does
anyone know what I am doing wrong?





All times are GMT +1. The time now is 04:26 PM.

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