+ Reply to Thread
Results 1 to 4 of 4

building a complex formula with the IF statement and Mround function

  1. #1
    Registered User
    Join Date
    03-04-2013
    Location
    Belgium
    MS-Off Ver
    excel 2010
    Posts
    2

    Exclamation building a complex formula with the IF statement and Mround function

    Hi there,


    I work as a salesman and i use my excel sheets to track what i have sold, our company wants me to put prices with 2 decimals (we dont have fixed prices) here are some examples of the things i am struggeling with:

    all prices that end between the range 0.96 and 0.24 should become 0.25 ( 10.21 becomes 10.25 and 10.96 becomes 11.25)

    all prices that end between the range 0.26 and 0.49 should become 0.50 (10.26 becomes 10.50 and so on)

    all prices that end between the range 0.51 and 0.74 should become 0.75 (10.51 becomes 10.75 and so on)

    and finally all prices that end between the range 0.76 and 0.94 should become 0.95 (10.76 should become 10.95 and so on)



    can this be done in 1 formula or does it need separate ones to function correctly
    im at the end of my knowledge here so any help would be more then welcome.


    thanks upfront
    Last edited by echy; 03-04-2013 at 11:59 AM.

  2. #2
    Forum Guru
    Join Date
    08-05-2004
    Location
    NJ
    MS-Off Ver
    365
    Posts
    13,577

    Re: building a complex formula with the IF statement and Mround function

    Try this formula
    =IF(OR(MOD(A1,1)={0.25,0.5,0.75,0.95}),A1, IF(MOD(A1,1)>0.95, CEILING(A1+0.05, 0.25), IF(MOD(A1,1)>0.75,INT(A1)+0.95,CEILING(A1+0.01, 0.25)))) (replacing commas with semicolons depending on local settings)
    Does that work for you?
    ChemistB
    My 2?

    substitute commas with semi-colons if your region settings requires
    Don't forget to mark threads as "Solved" (Edit First post>Advanced>Change Prefix)
    If I helped, Don't forget to add to my reputation (click on the little star at bottom of this post)

    Forum Rules: How to use code tags, mark a thread solved, and keep yourself out of trouble

  3. #3
    Registered User
    Join Date
    03-04-2013
    Location
    Belgium
    MS-Off Ver
    excel 2010
    Posts
    2

    Re: building a complex formula with the IF statement and Mround function

    worked like a charm thanks allot

  4. #4
    Forum Expert
    Join Date
    06-26-2010
    Location
    Austin, TX
    MS-Off Ver
    Excel 2010
    Posts
    1,673

    Re: building a complex formula with the IF statement and Mround function

    Yes, I know ChemistB's formula works, but I worked out a different method and wanted to share. This assumes your cost is in H1:
    =INT(H1+0.04)+INDEX({0.25,0.5,0.75,0.95},MATCH(MOD(H1+0.04,1),{0,0.2999,0.54999,0.799}))
    Pauley
    --------
    If I helped with your issue, I'd appreciate a rep bump (hit the '*' icon to the bottom left of this post).

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

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