Fishboy
Well-known Member
- Joined
- Feb 13, 2015
- Messages
- 4,267
Afternoon all,
I have just imported a CSV into Excel 2010 which contains fictional sale data from my friend's online game. The value of the sales has been recorded as a long continuous string of numbers but should read as Gold, Silver and Copper coin currency, for example 10g20s44c.
For arguement's sake I can explain that 100 copper make a silver, and 100 silver make a gold.
Example data:
267556 (should read as 26.75.56)
4657185 (should read as 465.71.85)
002015 (should read as 00.20.15)
57624526 (should read as 5762.45.26)
Now, here is my problem -
I want to use a formula to insert a decimal point in between the gold, silver and copper coins as per the examples above.
I tried this first:
=LEFT(A2,2)&"."&MID(A2,3,2)&"."&MID(A2,4,2)
It turns out I can't use a formula with LEFT in, as despite the coppers and silvers always being 2 digits (00 to 99), the amount of gold can vary from a value as short at 2 digits (i.e 00 to 99) up into 3, 4 or even 5 digit numbers (i.e, hundreds, thousands or tens of thousands).
I tried amending a LEFT formula into a RIGHT formula as follows:
=RIGHT(A2,2)&"."&MID(A2,3,2)&"."&MID(A2,4,2)
I hoped that would read the long string number is A2, counting back 2 numbers from the last digit on the right and insert a decimal point (separating the coppers). Then count 2 more numbers back and add another decimal point (separating the silvers). This meant it didn't matter how big the gold value was, the decimals were always in the right place.
But there in lies the rub...
Firstly the layout of this formula brings back the last 2 digits first (i.e the coppers show at the front end, not at the back end) so a string of 102044 comes back as 44.20.04. Secondly I cannot make it count the first numbers up as far as the first decimal point at all!
I know I am just laying the formula out incorrectly, but for the life of me I am lost and scratching my head.
I have just imported a CSV into Excel 2010 which contains fictional sale data from my friend's online game. The value of the sales has been recorded as a long continuous string of numbers but should read as Gold, Silver and Copper coin currency, for example 10g20s44c.
For arguement's sake I can explain that 100 copper make a silver, and 100 silver make a gold.
Example data:
267556 (should read as 26.75.56)
4657185 (should read as 465.71.85)
002015 (should read as 00.20.15)
57624526 (should read as 5762.45.26)
Now, here is my problem -
I want to use a formula to insert a decimal point in between the gold, silver and copper coins as per the examples above.
I tried this first:
=LEFT(A2,2)&"."&MID(A2,3,2)&"."&MID(A2,4,2)
It turns out I can't use a formula with LEFT in, as despite the coppers and silvers always being 2 digits (00 to 99), the amount of gold can vary from a value as short at 2 digits (i.e 00 to 99) up into 3, 4 or even 5 digit numbers (i.e, hundreds, thousands or tens of thousands).
I tried amending a LEFT formula into a RIGHT formula as follows:
=RIGHT(A2,2)&"."&MID(A2,3,2)&"."&MID(A2,4,2)
I hoped that would read the long string number is A2, counting back 2 numbers from the last digit on the right and insert a decimal point (separating the coppers). Then count 2 more numbers back and add another decimal point (separating the silvers). This meant it didn't matter how big the gold value was, the decimals were always in the right place.
But there in lies the rub...
Firstly the layout of this formula brings back the last 2 digits first (i.e the coppers show at the front end, not at the back end) so a string of 102044 comes back as 44.20.04. Secondly I cannot make it count the first numbers up as far as the first decimal point at all!
I know I am just laying the formula out incorrectly, but for the life of me I am lost and scratching my head.