View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.worksheet.functions
Bernard Liengme Bernard Liengme is offline
external usenet poster
 
Posts: 4,393
Default Conversion of numbers

What a lovely typo
I will leave it to YOU ......
--
Bernard V Liengme
www.stfx.ca/people/bliengme
remove caps from email

"Bernard Liengme" wrote in message
...
1) I will assume there are always 2 digits before the first hyphen
2) You state:"However if there are three decimals eg 99-021 the last digit
refers to the number of 124:s. Thus the price is 99 and 2/32 and 1/256." I
will assume this should be 1/124
With the coded value (and Oh what a code!) in A1
In B1 we get the dollar amount with =--LEFT(A1,2)
In C1 we get the 32-th bit with =MID(A1,4,2)/32
In D1 we get the 1/124 bit or the 1/64 correction with
=IF(ISNUMBER(--MID(A1,6,1)),RIGHT(A1)/124,IF(RIGHT(A1)="+",1/64,IF(RIGHT(A1)="-",-1/64,0)))
And in E1 we get the total with =SUM(B1:D1)
I recommend you test this with more examples
I will leave it to use to combine all of this into one simple formula if
so desired
And I expect others to give a us nice VBA solution
best wishes
--
Bernard V Liengme
www.stfx.ca/people/bliengme
remove caps from email

"Arne Hegefors" wrote in message
...
Hi! I have a list with prices of US Treasury bonds. They are quoted in a
partcular way that I would like to convert to decimal form. They are
quoted
like this eg: 99-02. Now this means that the price is 99 and some
decimal.
The two first numbers are the number of 32:s. Thus in this case the price
is
99 and 2/32. However if there are three decimals eg 99-021 the last digit
refers to the number of 124:s. Thus the price is 99 and 2/32 and 1/256.
Sometimes There are only two decimals followed by a plus or minus sign eg
99-30+ or 99-10-. The plus/minus indicates that you should add/subtract
1/64.
Is there any way that I can convert these price quotes into decimal form
using worksheet functions? Any help very much appreciated! Thanks a lot
in
advance!