+ Reply to Thread
Results 1 to 22 of 22

formula that adds/subtracts from 00 to 32 vs 00 to 100

  1. #1
    Forum Contributor
    Join Date
    05-22-2007
    Location
    Laguna Beach, CA
    Posts
    142

    formula that adds/subtracts from 00 to 32 vs 00 to 100

    I trade the futures markets and I've created a spreadsheet that keeps track of my trades.

    My formula is pretty simple:

    a1 = ZB (commodity)
    b1 = B or S (Buy or Sell)
    c1 = entry price
    d1 = exit price
    e1 = profit/loss
    f1 = formula the looks at a1 and looks up the appropriate point (tic) value

    the formula in e1 "=if(b1="S",c1-d1,d1-c1)"

    This formula works great on "most" markets except the Bond market which trades in increments of 1/32 (00 to 31 or 32 points (ticks)).

    Let's say I buy at 155.30 and exit at 156.02 it should show 04 points (tics) in profit (31, 00, 01, 02) but it shows 72 points (tics) in profits because its counting to 100.

    So, what do I need to add to the e1 formula so it counts in 1/32's when "a1 - ZB"?

    Any help will be appreciated.

    Bruce
    Last edited by InvGrp2; 08-22-2017 at 12:05 PM.

  2. #2
    Forum Moderator Glenn Kennedy's Avatar
    Join Date
    07-08-2012
    Location
    Digital Nomad... occasionally based in Ireland.
    MS-Off Ver
    O365 (PC) V 2403
    Posts
    44,023

    Re: formula that adds/subtracts from 00 to 32 vs 00 to 100

    This is the formula that you need; but I got a bit confused about where it fits into your overall formula:

    =(32*INT(B1)+100*MOD(B1,1))-(32*INT(A1)+100*MOD(A1,1))

    assumes buy in A1 and sell in B1....
    Glenn




    None of us get paid for helping you... we do this for fun. So DON'T FORGET to say "Thank You" to all who have freely given some of their time to help YOU.

    Temporary addition of accented to illustrate ongoing problem to the TT: L? fh?ile P?draig sona dhaoibh

  3. #3
    Forum Contributor
    Join Date
    05-22-2007
    Location
    Laguna Beach, CA
    Posts
    142

    Re: formula that adds/subtracts from 00 to 32 vs 00 to 100

    B1 is where I insert a "B" or "S" for a buy or sell.

    E1 looks in B1 and if its an "S" it subtracts C1 from D1, if B1 is not an "S" is subtracts D1 from C1.

    Where in the E1 formula would I insert your formula or would I use your entire formula?

    Thanks.

    Bruce

  4. #4
    Forum Guru
    Join Date
    04-13-2005
    Location
    North America
    MS-Off Ver
    2002/XP and 2007
    Posts
    15,819

    Re: formula that adds/subtracts from 00 to 32 vs 00 to 100

    This is the exact situation for which the DOLLARDE() and DOLLARFR() functions are included.

    Use DOLLARDE() to convert your dollar.32nds of a dollar to decimal dollars https://support.office.com/en-us/art...d-a38476693427
    subtract the numbers
    then, if desired, convert back to dollar.32nds of a dollar using the DOLLARFR() function https://support.office.com/en-us/art...4-3042c5d4f495

    something like =DOLLARFR(DOLLARDE(155.3,32)-DOLLARDE(156.02,32),32) returns -0.04 (meaning -4/32)
    Quote Originally Posted by shg
    Mathematics is the native language of the natural world. Just trying to become literate.

  5. #5
    Forum Moderator Glenn Kennedy's Avatar
    Join Date
    07-08-2012
    Location
    Digital Nomad... occasionally based in Ireland.
    MS-Off Ver
    O365 (PC) V 2403
    Posts
    44,023

    Re: formula that adds/subtracts from 00 to 32 vs 00 to 100

    Post a sample sheet.

    Unfortunately the attachment icon doesn't work at the moment. So, to attach an Excel file you have to do the following: Just before posting, scroll down to Go Advanced and then scroll down to Manage Attachments. Now follow the instructions at the top of that screen.

  6. #6
    Forum Contributor
    Join Date
    05-22-2007
    Location
    Laguna Beach, CA
    Posts
    142

    Re: formula that adds/subtracts from 00 to 32 vs 00 to 100

    I'm really a novice at excel and these types of formulas.

    Here's my current formula "=IF(E90="S",G90-I90,I90-G90)" and I need help in modifying it to look at "C90" and if ZB count in 1/32's" and if not ZB count as it counts.

    Thanks.

    Bruce

  7. #7
    Forum Moderator Glenn Kennedy's Avatar
    Join Date
    07-08-2012
    Location
    Digital Nomad... occasionally based in Ireland.
    MS-Off Ver
    O365 (PC) V 2403
    Posts
    44,023

    Re: formula that adds/subtracts from 00 to 32 vs 00 to 100

    Try this. If this does not work then read Post 5 again, and act on it.

    =IF(C90="ZB",IF(E90="S",(32*INT(I90)+100*MOD(I90,1))-(32*INT(G90)+100*MOD(G90,1)),(32*INT(G90)+100*MOD(G90,1))-(32*INT(I90)+100*MOD(I90,1))),IF(E90="S",G90-I90,I90-G90))
    Attached Files Attached Files
    Last edited by Glenn Kennedy; 08-22-2017 at 01:09 PM.

  8. #8
    Forum Guru
    Join Date
    04-13-2005
    Location
    North America
    MS-Off Ver
    2002/XP and 2007
    Posts
    15,819

    Re: formula that adds/subtracts from 00 to 32 vs 00 to 100

    Using my solution, I would probably do something like =DOLLARDE(number,IF(C90="ZB",32,100))

  9. #9
    Forum Contributor
    Join Date
    05-22-2007
    Location
    Laguna Beach, CA
    Posts
    142

    Re: formula that adds/subtracts from 00 to 32 vs 00 to 100

    here it is.

    thanks again for all your help.

    Bruce
    Attached Files Attached Files

  10. #10
    Forum Moderator Glenn Kennedy's Avatar
    Join Date
    07-08-2012
    Location
    Digital Nomad... occasionally based in Ireland.
    MS-Off Ver
    O365 (PC) V 2403
    Posts
    44,023

    Re: formula that adds/subtracts from 00 to 32 vs 00 to 100

    How can you tell that trade 2 is a Bond trade, and is subject to tics????

    I'm an analytical chemist, not a financier and need to have these things explained!!!

  11. #11
    Forum Moderator Glenn Kennedy's Avatar
    Join Date
    07-08-2012
    Location
    Digital Nomad... occasionally based in Ireland.
    MS-Off Ver
    O365 (PC) V 2403
    Posts
    44,023

    Re: formula that adds/subtracts from 00 to 32 vs 00 to 100

    I'm confuses

    Is G buy price when buying AND selling??? or what??

  12. #12
    Forum Contributor
    Join Date
    05-22-2007
    Location
    Laguna Beach, CA
    Posts
    142

    Re: formula that adds/subtracts from 00 to 32 vs 00 to 100

    column "L" uses column "C" to determine how the profit is calculated.

    Your formula works but the results is -4.0 and it needs to +.04.

  13. #13
    Forum Contributor
    Join Date
    05-22-2007
    Location
    Laguna Beach, CA
    Posts
    142

    Re: formula that adds/subtracts from 00 to 32 vs 00 to 100

    G is entry price (could be buy or sell) and I is exit price (opposite of whats in G).

    E is B or S (buy or sell).

  14. #14
    Forum Moderator Glenn Kennedy's Avatar
    Join Date
    07-08-2012
    Location
    Digital Nomad... occasionally based in Ireland.
    MS-Off Ver
    O365 (PC) V 2403
    Posts
    44,023

    Re: formula that adds/subtracts from 00 to 32 vs 00 to 100

    The penny drops, finally. Back shortly.

  15. #15
    Forum Moderator Glenn Kennedy's Avatar
    Join Date
    07-08-2012
    Location
    Digital Nomad... occasionally based in Ireland.
    MS-Off Ver
    O365 (PC) V 2403
    Posts
    44,023

    Re: formula that adds/subtracts from 00 to 32 vs 00 to 100

    No wonder the world is in a mess. Let me get this right.

    If it's a BUY, the Profit/loss is I minus G.

    if it's a sell the Profit/Loss is I minus G?

    If not, then what?

  16. #16
    Forum Contributor
    Join Date
    05-22-2007
    Location
    Laguna Beach, CA
    Posts
    142

    Re: formula that adds/subtracts from 00 to 32 vs 00 to 100

    close!

    If it's a BUY, the Profit/loss is I minus G.

    if it's a sell the Profit/Loss is G minus I?

  17. #17
    Forum Moderator Glenn Kennedy's Avatar
    Join Date
    07-08-2012
    Location
    Digital Nomad... occasionally based in Ireland.
    MS-Off Ver
    O365 (PC) V 2403
    Posts
    44,023

    Re: formula that adds/subtracts from 00 to 32 vs 00 to 100

    OK. I'll stick to Chemistry, methinks. I'll sort it asap. Off to eat now (late p.m. in Europe).

  18. #18
    Forum Contributor
    Join Date
    05-22-2007
    Location
    Laguna Beach, CA
    Posts
    142

    Re: formula that adds/subtracts from 00 to 32 vs 00 to 100

    I modified your formula so instead of showing -4.0 it now shows +4.0 but its still needs to be .04 and not 4.0.

    I tried adding /100 but that didn't work.

    =IF(C5="ZB3",IF(E5="S",(32*INT(G5)+100*MOD(G5,1))-(32*INT(I5)+100*MOD(I5,1)),(32*INT(I5)+100*MOD(I5,1))-(32*INT(G5)+100*MOD(G5,1))),IF(E5="S",G5-I5,I5-G5))

    Bruce

  19. #19
    Forum Contributor
    Join Date
    05-22-2007
    Location
    Laguna Beach, CA
    Posts
    142

    Re: formula that adds/subtracts from 00 to 32 vs 00 to 100

    Glenn:

    your formula is really close, all its needs is to be /100 and that should do it.

    Have a nice lunch and thanks again.

  20. #20
    Forum Moderator Glenn Kennedy's Avatar
    Join Date
    07-08-2012
    Location
    Digital Nomad... occasionally based in Ireland.
    MS-Off Ver
    O365 (PC) V 2403
    Posts
    44,023

    Re: formula that adds/subtracts from 00 to 32 vs 00 to 100

    It did just need the /100, along with another set of parentheses:

    =IF(C3="ZB3",IF(E3="S",((32*INT(G3)+100*MOD(G3,1))-(32*INT(I3)+100*MOD(I3,1)))/100,((32*INT(I3)+100*MOD(I3,1))-(32*INT(G3)+100*MOD(G3,1)))/100),IF(E3="S",G3-I3,I3-G3))

    Hope this is it!



    If that takes care of your original question, please select "Thread Tools" from the menu link above and mark this thread as SOLVED.

    It'd also be appreciated if you were to click the Add Reputation button at the foot of any of the posts of all members who helped you reach a solution.
    Attached Files Attached Files

  21. #21
    Forum Contributor
    Join Date
    05-22-2007
    Location
    Laguna Beach, CA
    Posts
    142

    Re: formula that adds/subtracts from 00 to 32 vs 00 to 100

    It worked perfectly!!!!

    I tried to /100 but I combined the entire 1st section where you split the 1st section in two parts.

    You're the best.

    Thanks again.

    Bruce

  22. #22
    Forum Moderator Glenn Kennedy's Avatar
    Join Date
    07-08-2012
    Location
    Digital Nomad... occasionally based in Ireland.
    MS-Off Ver
    O365 (PC) V 2403
    Posts
    44,023

    Re: formula that adds/subtracts from 00 to 32 vs 00 to 100

    You're welcome. Not the best though. I made a total mess of another one a little earlier today.

+ 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. Replies: 10
    Last Post: 03-17-2016, 05:34 AM
  2. [SOLVED] Modify Code that updates (adds/subtracts) One cell by the changing inputs of another
    By TheScott in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 04-19-2015, 01:30 PM
  3. Button that subtracts .76, then subtracts from abother cell
    By THEQ100 in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 01-18-2014, 09:41 AM
  4. [SOLVED] Need a formula that subtracts or adds a a specific value
    By superchew in forum Excel General
    Replies: 2
    Last Post: 10-22-2013, 12:23 PM
  5. [SOLVED] Sum adds rather than subtracts negative numbers?
    By innatedoc in forum Excel Formulas & Functions
    Replies: 5
    Last Post: 10-23-2012, 01:31 AM
  6. creating a button that adds/subtracts
    By gbWildy in forum Excel Formulas & Functions
    Replies: 6
    Last Post: 06-26-2007, 01:10 PM
  7. Replies: 0
    Last Post: 10-04-2005, 08:05 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