Closed Thread
Results 1 to 23 of 23

Combining a list of formulas into one field including checking for 3rd decimal place

  1. #1
    Registered User
    Join Date
    04-14-2021
    Location
    UK
    MS-Off Ver
    Office365
    Posts
    35

    Exclamation Combining a list of formulas into one field including checking for 3rd decimal place

    Hi,

    I am trying to incorporate all of the below into one field. This basically does a sum, multiplies by 13.8% and then checks if the 3rd decimal place is >=6, if it is then round up or else round down. It does the same for the second part of the formula and then adds the two results together to get the final answer.

    Example:
    1. 5000-1548 = 3452
    2. 3452 * 13.8% = 476.376
    3. The 3rd decimal is >=6 so round up
    4. = 476.38 --> Store this value
    5. 900-89 = 811
    6. 811 * 13.8% = 111.918
    7. The 3rd decimal is >=6 so round up
    8. = 111.92 --> Store this value
    9. Add amounts from step 4 and step 8 together (476.38 + 111.92)
    10. = 588.30

    The problem I am having is using steps 3 and 7 within one formula. Attached is an example of the above but if I can get it all in one field i.e column C13 that would be easier.

    Note the command to get the right most digit is =VALUE(RIGHT(476.376,1))

    Any help would be greatly appreciated.

    Example.PNG

    Thanks
    Attached Files Attached Files

  2. #2
    Forum Moderator AliGW's Avatar
    Join Date
    08-10-2013
    Location
    Retired in Ipswich, Suffolk, but grew up in Sawley, Derbyshire (both in England)
    MS-Off Ver
    MS 365 Subscription Insider Beta Channel v. 2503 (Windows 11 Home 24H2 64-bit)
    Posts
    90,404

    Re: Combining a list of formulas into one field including checking for 3rd decimal place

    Welcome to the forum.

    =ROUND(((13.8/100)*(5000-1548)),2)+ROUND(((13.8/100)*(5000-4189)),2)

    or this:

    =IF(VALUE(RIGHT(((13.8/100)*(5000-1548)),1))>6,ROUNDUP(((13.8/100)*(5000-1548)),2),ROUNDDOWN(((13.8/100)*(5000-1548)),2))+IF(VALUE(RIGHT(((13.8/100)*(5000-4189)),1))>6,ROUNDUP(((13.8/100)*(5000-4189)),2),ROUNDdwn(((13.8/100)*(5000-4189)),2))
    Last edited by AliGW; 04-14-2021 at 11:21 AM.
    Ali


    Enthusiastic self-taught user of MS Excel who's always learning!
    Don't forget to say "thank you" in your thread to anyone who has offered you help. It's a universal courtesy.
    You can reward them by clicking on * Add Reputation below their user name on the left, if you wish.

    NB:
    as a Moderator, I never accept friendship requests.
    Forum Rules (updated August 2023): please read them here.

  3. #3
    Forum Expert
    Join Date
    05-05-2015
    Location
    UK
    MS-Off Ver
    Microsoft Excel for Microsoft 365 MSO (Version 2402 Build 16.0.17328.20068) 64-bit
    Posts
    30,743

    Re: Combining a list of formulas into one field including checking for 3rd decimal place

    Deleted ....

  4. #4
    Registered User
    Join Date
    04-14-2021
    Location
    UK
    MS-Off Ver
    Office365
    Posts
    35

    Re: Combining a list of formulas into one field including checking for 3rd decimal place

    Thank you for this, if the amounts in step 5 and step 10 contain numbers that are <=6 will this still work with that you have provided?

    i.e if it can do that "check for 3rd decimal" within the formula itself so it works out when to round up or round down that would be fantastic.

    Sorry I replied before the post was updated! ignore this i'll try the above and see if that works.

  5. #5
    Forum Moderator AliGW's Avatar
    Join Date
    08-10-2013
    Location
    Retired in Ipswich, Suffolk, but grew up in Sawley, Derbyshire (both in England)
    MS-Off Ver
    MS 365 Subscription Insider Beta Channel v. 2503 (Windows 11 Home 24H2 64-bit)
    Posts
    90,404

    Re: Combining a list of formulas into one field including checking for 3rd decimal place

    My second formula does all of that.

  6. #6
    Forum Moderator AliGW's Avatar
    Join Date
    08-10-2013
    Location
    Retired in Ipswich, Suffolk, but grew up in Sawley, Derbyshire (both in England)
    MS-Off Ver
    MS 365 Subscription Insider Beta Channel v. 2503 (Windows 11 Home 24H2 64-bit)
    Posts
    90,404

    Re: Combining a list of formulas into one field including checking for 3rd decimal place

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

    Also, you may not be aware that you can thank those who have helped you by clicking the small star icon located in the lower left corner of the post in which the help was given. By doing so you can add to the reputation(s) of those who helped.

  7. #7
    Registered User
    Join Date
    04-14-2021
    Location
    UK
    MS-Off Ver
    Office365
    Posts
    35

    Re: Combining a list of formulas into one field including checking for 3rd decimal place

    Hi I just had to tweak it a bit because the 3rd decimal is a greater than or equal to so I ended up with this:

    =IF(VALUE(RIGHT(((13.8/100)*(5000-1548)),1))>=6,ROUNDUP(((13.8/100)*(5000-1548)),2),ROUNDDOWN(((13.8/100)*(5000-1548)),2))+IF(VALUE(RIGHT(((13.8/100)*(5000-4189)),1))>=6,ROUNDUP(((13.8/100)*(5000-4189)),2),ROUNDdwn(((13.8/100)*(5000-4189)),2))

    This seems to work! Many thanks for your response.

    I have already added a reputation start to your name and will resolve this thread, unless you think me adding the > sign is not good practice within the above formula?

    Thanks

  8. #8
    Forum Moderator AliGW's Avatar
    Join Date
    08-10-2013
    Location
    Retired in Ipswich, Suffolk, but grew up in Sawley, Derbyshire (both in England)
    MS-Off Ver
    MS 365 Subscription Insider Beta Channel v. 2503 (Windows 11 Home 24H2 64-bit)
    Posts
    90,404

    Re: Combining a list of formulas into one field including checking for 3rd decimal place

    No, that's fine - should work for you.

    Thanks for the rep.

  9. #9
    Registered User
    Join Date
    04-14-2021
    Location
    UK
    MS-Off Ver
    Office365
    Posts
    35

    Re: Combining a list of formulas into one field including checking for 3rd decimal place

    Thank you. closing this thread now

  10. #10
    Registered User
    Join Date
    04-14-2021
    Location
    UK
    MS-Off Ver
    Office365
    Posts
    35

    Re: Combining a list of formulas into one field including checking for 3rd decimal place

    Hi its me again,

    When using different numbers and percentages this seems to fall off a bit and end up being out by 1. Is there a way I can truncate to 3 decimals first before doing the rest of the formula?

    Example:

    1. 4189-797 = 3392
    2. 3392 * 5.85% = 198.432
    3. The 3rd decimal is not >=6 so round down
    4. = 198.43 --> Store this value
    5. 4189.29-4189 = 0.29
    6. 0.29 * 2% = 0.0058
    7. Truncate this to 3 decimal places = 0.005
    8. The 3rd decimal is not >=6 so round down
    9. = 0.00 --> Store this value
    10. Add amounts from step 4 and step 9 together (198.43 + 0.00)
    11. = 198.43

    At steps 2 and 6 whatever the result is I need to get it to truncate to at least 3dp if it is shown as more than 3dp if that makes sense?

  11. #11
    Registered User
    Join Date
    04-14-2021
    Location
    UK
    MS-Off Ver
    Office365
    Posts
    35

    Re: Combining a list of formulas into one field including checking for 3rd decimal place

    On steps 2 and 6 I would probably need to add another IF to check if the figure is greater than 3dp in order to truncate im guessing?

  12. #12
    Forum Expert
    Join Date
    05-05-2015
    Location
    UK
    MS-Off Ver
    Microsoft Excel for Microsoft 365 MSO (Version 2402 Build 16.0.17328.20068) 64-bit
    Posts
    30,743

    Re: Combining a list of formulas into one field including checking for 3rd decimal place

    Try

    =IF(--RIGHT(($A1-$B1)*C1,1)>=6,ROUNDUP(($A1-$B1)*$C1,2),ROUNDDOWN(($A1-$B1)*C1,2))+IF(--RIGHT(ROUNDDOWN(($D1-$E1)*$F1,3),1)>=6,ROUNDUP(ROUNDDOWN(($D1-$E1)*$F1,3),2),ROUNDDOWN(ROUNDDOWN(($D1-$E1)*$F1,3),2))

    See attached
    Attached Files Attached Files

  13. #13
    Registered User
    Join Date
    04-14-2021
    Location
    UK
    MS-Off Ver
    Office365
    Posts
    35

    Re: Combining a list of formulas into one field including checking for 3rd decimal place

    Thanks for the above

    I can see you have added the ",3" in there to the latter part of the formula. Is there a way we can make this more transparent that whenever multiplying by the percentages if it does come in a figure that has more then 3dp then apply the truncation.

    For example can we put the ",3" in both parts so that whatever numbers are used when multiplying by the percentages it will always either truncate to 3dp if its greater than 3dp or not?

    Thanks in advance!

  14. #14
    Forum Expert
    Join Date
    05-05-2015
    Location
    UK
    MS-Off Ver
    Microsoft Excel for Microsoft 365 MSO (Version 2402 Build 16.0.17328.20068) 64-bit
    Posts
    30,743

    Re: Combining a list of formulas into one field including checking for 3rd decimal place

    Why not try to change it yourself?

    Any calculation is likely to have more than 3 dp: formatting only shows dp that are specified.

  15. #15
    Forum Expert bebo021999's Avatar
    Join Date
    07-22-2011
    Location
    Vietnam
    MS-Off Ver
    Excel 2016
    Posts
    9,645

    Re: Combining a list of formulas into one field including checking for 3rd decimal place

    Instead of ROUNDUP then ROUNDDOWN, I suggest to add 0.004001, then rounddown (using FLOOR):

    198.432+0.004001 = 198.436001 => 198.43
    198.59 + 0.004001 = 198.594001 = > 198.59
    198.60 + 0.004001 = 198.604001 = > 198.60
    0.0058 + 0.004001 = 0.009801 = > 0

    Final formula:

    Please Login or Register  to view this content.
    Attached Images Attached Images
    Quang PT

  16. #16
    Registered User
    Join Date
    04-14-2021
    Location
    UK
    MS-Off Ver
    Office365
    Posts
    35

    Re: Combining a list of formulas into one field including checking for 3rd decimal place

    Thanks for the responses will try them now.

    Does the Floor command just truncate to 2dp?

  17. #17
    Registered User
    Join Date
    04-14-2021
    Location
    UK
    MS-Off Ver
    Office365
    Posts
    35

    Re: Combining a list of formulas into one field including checking for 3rd decimal place

    I tried to add the ,3 in at the first part but it didnt work. Must be missing something:

    =IF(--RIGHT((($A1-$B1)*C1,3),1)>=6,ROUNDUP((($A1-$B1)*$C1,3),2),ROUNDDOWN((($A1-$B1)*C1,3),2))
    +
    IF(--RIGHT(ROUNDDOWN(($D1-$E1)*$F1,3),1)>=6,ROUNDUP(ROUNDDOWN(($D1-$E1)*$F1,3),2),ROUNDDOWN(ROUNDDOWN(($D1-$E1)*$F1,3),2))

  18. #18
    Registered User
    Join Date
    04-14-2021
    Location
    UK
    MS-Off Ver
    Office365
    Posts
    35

    Re: Combining a list of formulas into one field including checking for 3rd decimal place

    Got it working eventually! I didnt go for the floor method as still not sure what the 004001 equates to sorry.

    final formula, Had to plug in the numbers to be sure first:

    =
    IF(
    --RIGHT(ROUNDDOWN((4189-797)*C1,3),1)
    >=6,
    ROUNDUP(ROUNDDOWN((4189-797)*C1,3),2),
    ROUNDDOWN(ROUNDDOWN((4189-797)*C1,3),2)
    )
    +
    IF(
    --RIGHT(ROUNDDOWN((4189.29-4189)*F1,3),1)
    >=6,
    ROUNDUP(ROUNDDOWN((4189.29-4189)*F1,3),2),
    ROUNDDOWN(ROUNDDOWN((4189.29-4189)*F1,3),2)
    )

  19. #19
    Registered User
    Join Date
    04-14-2021
    Location
    UK
    MS-Off Ver
    Office365
    Posts
    35

    Re: Combining a list of formulas into one field including checking for 3rd decimal place

    Marking as solved again! Thank you everyone.

  20. #20
    Forum Expert bebo021999's Avatar
    Join Date
    07-22-2011
    Location
    Vietnam
    MS-Off Ver
    Excel 2016
    Posts
    9,645

    Re: Combining a list of formulas into one field including checking for 3rd decimal place

    Quote Originally Posted by Engineer445 View Post
    Does the Floor command just truncate to 2dp?
    FLOOR(X,0.01) is rounddown number X to nearest 0.01
    I am sure my formula works. Test it.

  21. #21
    Registered User
    Join Date
    04-14-2021
    Location
    UK
    MS-Off Ver
    Office365
    Posts
    35

    Re: Combining a list of formulas into one field including checking for 3rd decimal place

    Sorry it's me again some years later with the same issue however the examples above seem to still be a penny out in excel and I am struggling to see where.

    See the attached

    The amount I am looking for is 522.31 but I am getting 522.30

    It is not recognizing the 2rd digit being 0.006 and not doing the rounding up

    I need it to calculate as per "example 1" but it is calculating as per "example 2" and being a penny out.
    Attachment 884751

    Attachment 884752


    The formula for example 2 was the one listed earlier in this forum but doesnt seem to work with these particular numbers:

    =
    IF(--RIGHT(ROUNDDOWN(G15*(E15-F15),3),1)>=6,
    ROUNDUP(ROUNDDOWN(G15*(E15-F15),3),2),
    ROUNDDOWN(ROUNDDOWN(G15*(E15-F15),3),2))
    +
    IF(--RIGHT(ROUNDDOWN(H15*(I15-E15),3),1)>=6,
    ROUNDUP(ROUNDDOWN(H15*(I15-E15),3),2),
    ROUNDDOWN(ROUNDDOWN(H15*(E15-E15),3),2))

  22. #22
    Registered User
    Join Date
    04-14-2021
    Location
    UK
    MS-Off Ver
    Office365
    Posts
    35

    Re: Combining a list of formulas into one field including checking for 3rd decimal place

    sorry forgot to attach the example spreadsheet:
    Attached Files Attached Files

  23. #23
    Forum Moderator AliGW's Avatar
    Join Date
    08-10-2013
    Location
    Retired in Ipswich, Suffolk, but grew up in Sawley, Derbyshire (both in England)
    MS-Off Ver
    MS 365 Subscription Insider Beta Channel v. 2503 (Windows 11 Home 24H2 64-bit)
    Posts
    90,404

    Re: Combining a list of formulas into one field including checking for 3rd decimal place

    Several years later ... so please start a new thread. Thanks.

Closed Thread

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. Combining 2 sets of data using Name field
    By harrowerjohn in forum Excel General
    Replies: 3
    Last Post: 07-11-2020, 11:33 AM
  2. Replies: 1
    Last Post: 06-30-2019, 03:35 PM
  3. New Field / Column added not getting displayed in Pivot Field List
    By excel_googler in forum Excel Charting & Pivots
    Replies: 1
    Last Post: 01-02-2019, 05:42 AM
  4. Pivot combining a field
    By laali in forum Excel Charting & Pivots
    Replies: 2
    Last Post: 09-13-2016, 06:57 AM
  5. [SOLVED] Combining 2 formulas to one in a validation list
    By dawondr in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 05-07-2013, 11:38 AM
  6. [SOLVED] Combining If Statement, Is Blank Statement and HLookUp
    By kimberlyre2000 in forum Excel Formulas & Functions
    Replies: 1
    Last Post: 11-29-2012, 01:27 PM
  7. Combining If statement and data validation (non-list)
    By zangana in forum Excel General
    Replies: 0
    Last Post: 08-07-2012, 07:54 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