+ Reply to Thread
Results 1 to 13 of 13

how do I split/grab num of the last two decimal places?

  1. #1
    Forum Contributor
    Join Date
    08-18-2017
    Location
    London
    MS-Off Ver
    Excel 2016
    Posts
    308

    Talking how do I split/grab num of the last two decimal places?

    hi, any idea how do I split/grab num from the right side of the string:

    0.00022 = 22

    0.00005 = 05

    etc???

  2. #2
    Forum Expert
    Join Date
    04-23-2009
    Location
    Matrouh, Egypt
    MS-Off Ver
    Excel 2013
    Posts
    6,892

    Re: how do I split/grab num of the last two decimal places?

    Try this
    Please Login or Register  to view this content.
    < ----- Please click the little star * next to add reputation if my post helps you
    Visit Forum : From Here

  3. #3
    Forum Guru Andy Pope's Avatar
    Join Date
    05-10-2004
    Location
    Essex, UK
    MS-Off Ver
    O365
    Posts
    20,437

    Re: how do I split/grab num of the last two decimal places?

    You can use the RIGHT function

    Please Login or Register  to view this content.
    Cheers
    Andy
    www.andypope.info

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

    Re: how do I split/grab num of the last two decimal places?

    Are these text strings or numbers?

    As others have noted, if they are text strings, then it could be as simple as the Right() function: https://msdn.microsoft.com/en-us/vba...right-function
    If they are numbers, are those the exact values stored in the number, or are those rounded approximations to the actual value stored? I expect that the most reliable way to do this with numbers will be to use the Format() function (or similar number to string conversion function https://msdn.microsoft.com/en-us/vba...r-applications ) to convert the number to text with the correct number format, then use the Right() function. Assuming you want 5 digits after the decimal point =Right(Format(mynumber,"0.00000"),2)
    Quote Originally Posted by shg
    Mathematics is the native language of the natural world. Just trying to become literate.

  5. #5
    Forum Contributor
    Join Date
    08-18-2017
    Location
    London
    MS-Off Ver
    Excel 2016
    Posts
    308

    Re: how do I split/grab num of the last two decimal places?

    I have attached my sheet...
    Attached Files Attached Files

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

    Re: how do I split/grab num of the last two decimal places?

    You posted this in the VBA forum, so I think we all assumed that you were looking for a VBA solution. Your sample file contains no VBA, so can we assume you want a regular formula solution?

    It appears that these are numbers, and, due to floating point errors (see links discussing issue here: https://www.excelforum.com/groups/ma...nd-errors.html ), none of the values are exactly 5 digits long. In Excel, we can use the TEXT() function to convert a number to a text string in a specified number format, then nest that function inside of the RIGHT() function (similar to what I did using the Right(Format(...),2) function VBA function above). https://support.office.com/en-us/art...8-93d29371225c

  7. #7
    Forum Contributor
    Join Date
    08-18-2017
    Location
    London
    MS-Off Ver
    Excel 2016
    Posts
    308

    Re: how do I split/grab num of the last two decimal places?

    MrShorty I NOT looking for VBA solution.
    I think the "format cell" option is effect the calculation? which one do I set it to?

  8. #8
    Forum Contributor
    Join Date
    08-18-2017
    Location
    London
    MS-Off Ver
    Excel 2016
    Posts
    308

    Re: how do I split/grab num of the last two decimal places?

    how do I use that TEXT() function? or convert to text?

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

    Re: how do I split/grab num of the last two decimal places?

    Number formats should not have any effect on the underlying calculation, unless you have the "precision as displayed" option checked.

    In addition to using text formulas, which result in text string instead of numbers, it might be better to do this as a numeric operation. 1) Multiply by 1E5 then 2) Round that result to the nearest integer. Something like =ROUND(B2*1E5,0) which will result in the number 1 instead of the text string "01".

    It really depends on exactly what you are trying to do with this calculation and how this fits into your overall project. Personally I would be inclined towards a numeric operation rather than a text manipulation.

  10. #10
    Forum Contributor
    Join Date
    08-18-2017
    Location
    London
    MS-Off Ver
    Excel 2016
    Posts
    308

    Re: how do I split/grab num of the last two decimal places?

    thx MrShorty, that seems to work!!! as Im here could I ask another problem which needs solution?

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

    Re: how do I split/grab num of the last two decimal places?

    You can ask. There could be some discussion among the moderators whether you should start a new thread or not. If it is similar to this same question, then proceed in this thread. If it is different, start a new thread with your next question.

  12. #12
    Forum Contributor
    Join Date
    08-18-2017
    Location
    London
    MS-Off Ver
    Excel 2016
    Posts
    308

    Re: how do I split/grab num of the last two decimal places?

    thx how can I Normalized this fx dataset (see sheet) to simple digits of say from 0-9
    as so to be inputed into any excel functions (for algorithm trading system creation)?

    PS I can't use the raw data feed numbers of 1.18253 it just to complex for my excel functions.
    Is there so way to find the different and will represent the structure when graphed?

    see new sheet:
    Attached Files Attached Files
    Last edited by QuantEdge; 08-22-2017 at 12:33 PM.

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

    Re: how do I split/grab num of the last two decimal places?

    thx how can I Normalized this fx dataset (see sheet) to simple digits of say from 0-9 as so to be inputed into any excel functions (for algorithm trading system creation)?
    I don't do this kind of trading, so I'm not sure I understand the math behind your question. It might be preferable to ask someone who is more knowledgeable about these trading algorithms how they should work. Then, bring that information here and we can help you program that into Excel.

    One "typical" normalization algorithm I might use involves the TREND() function. Column C should return a value between 0 and 99 (if it really is always 2 digits), so one might use something like =TREND({0,9},{0,99},C2), which will "normalize" the 0 to 99 values in C2 onto a 0-9 scale. I have no idea why that would be better, or how that fits in to the trading algorithm, but that is one strategy for building a "normalization" formula in Excel.

+ 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. Adusting decimal places based on greatest number of places in a series
    By anelson87 in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 05-11-2022, 01:05 PM
  2. Replies: 2
    Last Post: 12-29-2013, 08:37 PM
  3. [SOLVED] copy number with 3 or more decimal places and paste the actual value as 2 decimal number
    By k1dr0ck in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 05-29-2013, 12:57 AM
  4. [SOLVED] Calculating decimal places in a non decimal format (ie sixes not tens)
    By Mike Brewer in forum Excel Formulas & Functions
    Replies: 5
    Last Post: 05-07-2013, 08:58 AM
  5. Replies: 4
    Last Post: 12-26-2012, 05:37 AM
  6. Paste two decimal number in excel without extra decimal places appearing
    By jeffery_frick in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 08-13-2009, 07:49 PM
  7. Replies: 4
    Last Post: 06-10-2009, 12:50 PM
  8. [SOLVED] FIXED 2 DECIMAL PLACES, MUST ENTER ALL ZEROES AFTER DECIMAL POINT.
    By SUKYKITTY in forum Excel General
    Replies: 3
    Last Post: 07-06-2005, 09:05 AM

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