+ Reply to Thread
Results 1 to 3 of 3

UDF for Converting Bond Price in Ticks to Decimal Number Format

  1. #1
    Registered User
    Join Date
    09-19-2015
    Location
    US
    MS-Off Ver
    2013
    Posts
    2

    UDF for Converting Bond Price in Ticks to Decimal Number Format

    I have two long formulas that I am trying to turn into a UDF because I use them frequently, and I am new to VBA.

    The first formula converts the tick price (Agency MBS convention) into a decimal number. The convention is shown below.
    Formula: copy to clipboard
    Please Login or Register  to view this content.

    ticktodec.PNG

    For 104-084, the "08" to the right of "-" represents 8/32's and the third number represents 4/8 of 1/32 or alternatively 4/256. The "+" means half of 1/32 or 4/256 as well.

    I created a UDF for this formula(=Pxd(n)), but it only works for 2 of the 4 different tick formats I need.

    Please Login or Register  to view this content.
    I tried to create a UDF for the second formula, which reverses the formula and converts decimals to ticks but kept running into errors.
    Formula: copy to clipboard
    Please Login or Register  to view this content.

    dectotick.PNG

    How do I fix the first UDF and how should I set up the UDF for the second formula? Thank you in advance for any help you can provide.
    Attached Files Attached Files

  2. #2
    Forum Expert skywriter's Avatar
    Join Date
    06-09-2014
    Location
    USA
    MS-Off Ver
    365 Version 2409
    Posts
    2,789

    Re: UDF for Converting Bond Price in Ticks to Decimal Number Format

    Try this:

    Please Login or Register  to view this content.
    Attached Files Attached Files
    Last edited by skywriter; 09-19-2015 at 11:42 PM.

  3. #3
    Registered User
    Join Date
    09-19-2015
    Location
    US
    MS-Off Ver
    2013
    Posts
    2

    Re: UDF for Converting Bond Price in Ticks to Decimal Number Format

    Thank you.

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. [SOLVED] Converting an elapsed time in decimal number format to an actual time :S
    By Spicey_888 in forum Excel General
    Replies: 3
    Last Post: 07-20-2014, 08:53 PM
  2. Formula for bond price
    By Dracan in forum Excel Formulas & Functions
    Replies: 11
    Last Post: 04-15-2014, 11:17 AM
  3. Keep number format when converting to text - with decimal and zeros
    By tampagirl in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 03-11-2014, 06:34 PM
  4. Bond price conversion
    By freddie mac in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 01-21-2014, 01:08 AM
  5. Need Help writing bond price conversion
    By elviejo41 in forum Excel General
    Replies: 5
    Last Post: 12-13-2006, 01:00 PM
  6. Replies: 3
    Last Post: 03-18-2006, 02:25 PM
  7. Calculating Bond Price
    By legu in forum Excel Formulas & Functions
    Replies: 0
    Last Post: 01-16-2006, 12:45 PM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1