![]() |
Extracting dollars and cents
I have a task which I would assume would be really simple, but I am going
thru hoops to get this done, and there MUST be a simpler way. What I want to do is separate and extract the dollars and cents from one figure. For example, $1000.07, I need to extract this (for forms) to 2 separate numbers...1000 (the dollar side) and 07 (the cent side WITHOUT a decimal point, and must show 07, not just 7) The dollar side is easy...I just use the TRUNC command, but the cents side is painful because Excel calculates out to x decimal points so I can't use the RIGHT command. What I end up doing is taking the dollar amount, subtracting the TRUNCATED amount, multiplying by 100, adding 100. (In the above case, this would yield 107...but actually 106.9999986). So I then need to ROUND this and at last, take the RIGHT 2 characters. There has got to be a better way to go from 1000.07 to 07. Any help would be kindly appreciated. Pradhan |
Extracting dollars and cents
=INT(A1) for the dollars
=TEXT(100*MOD(A1,1),"00") for the cents or =100*MOD(A1,1) and format as 00 -- David Biddulph "Pradhan" wrote in message ... I have a task which I would assume would be really simple, but I am going thru hoops to get this done, and there MUST be a simpler way. What I want to do is separate and extract the dollars and cents from one figure. For example, $1000.07, I need to extract this (for forms) to 2 separate numbers...1000 (the dollar side) and 07 (the cent side WITHOUT a decimal point, and must show 07, not just 7) The dollar side is easy...I just use the TRUNC command, but the cents side is painful because Excel calculates out to x decimal points so I can't use the RIGHT command. What I end up doing is taking the dollar amount, subtracting the TRUNCATED amount, multiplying by 100, adding 100. (In the above case, this would yield 107...but actually 106.9999986). So I then need to ROUND this and at last, take the RIGHT 2 characters. There has got to be a better way to go from 1000.07 to 07. Any help would be kindly appreciated. Pradhan |
All times are GMT +1. The time now is 04:35 AM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com