ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Discussion (Misc queries) (https://www.excelbanter.com/excel-discussion-misc-queries/)
-   -   Text to number conversion with trailing - (https://www.excelbanter.com/excel-discussion-misc-queries/247443-text-number-conversion-trailing.html)

wynand

Text to number conversion with trailing -
 
I would like to convert 1.234,00- to -1,234.00 for calculatation and
accounting purposes.
I received the formula for the trailing -:
=IF(TRIM(RIGHT(A1,1))="-","-"&SUBSTITUTE(TRIM(A1),"-",""),TRIM(A1))
The decimal comma problem can be corrected with a long edit/replace excercise:
, to x and . to y and then replace the x and y again with the correct
decimal and comma.

Can anyone help with one formula or VBA to do this all at once? And can such
a formula cater for negative and positive numbers?

Jacob Skaria

Text to number conversion with trailing -
 
--Select the range
--Hit Ctrl+H. Find what: , (comma) Replace with: leave blank and replace all
--From menu select DataText to ColumnsNextNext
--From 'Convert text to columns wizard Step3 of 3' hit 'Advanced' button.
Make sure you have checked 'trailing minus for negative numbers' and hit OK.
--Hit finish

If this post helps click Yes
---------------
Jacob Skaria


"wynand" wrote:

I would like to convert 1.234,00- to -1,234.00 for calculatation and
accounting purposes.
I received the formula for the trailing -:
=IF(TRIM(RIGHT(A1,1))="-","-"&SUBSTITUTE(TRIM(A1),"-",""),TRIM(A1))
The decimal comma problem can be corrected with a long edit/replace excercise:
, to x and . to y and then replace the x and y again with the correct
decimal and comma.

Can anyone help with one formula or VBA to do this all at once? And can such
a formula cater for negative and positive numbers?


B. R.Ramachandran

Text to number conversion with trailing -
 
Hi,

Try the formula,

=IF(ISNUMBER(FIND("-",A1)),"-","")&TRIM(SUBSTITUTE(SUBSTITUTE(SUBSTITUTE(SUBSTI TUTE(A1,".","x"),",","."),"x",","),"-",""))

Please click "Yes" if this is helpful.

Regards,
B. R. Ramachandran

"wynand" wrote:

I would like to convert 1.234,00- to -1,234.00 for calculatation and
accounting purposes.
I received the formula for the trailing -:
=IF(TRIM(RIGHT(A1,1))="-","-"&SUBSTITUTE(TRIM(A1),"-",""),TRIM(A1))
The decimal comma problem can be corrected with a long edit/replace excercise:
, to x and . to y and then replace the x and y again with the correct
decimal and comma.

Can anyone help with one formula or VBA to do this all at once? And can such
a formula cater for negative and positive numbers?



All times are GMT +1. The time now is 07:02 PM.

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