+ Reply to Thread
Results 1 to 6 of 6

How to write this nested if

  1. #1
    Forum Contributor
    Join Date
    11-20-2008
    Location
    UK
    Posts
    132

    How to write this nested if

    I have a workbook where Column C denotes the type of rate a client should pay on. Column E shows the hours they should be charged on and Column F the minutes.

    If C1=1 it means the client pays for rounded up hours so if E1=9 and F1=10, they pay for 10hrs (The client used 9hrs 10Mins but as its over 9hrs it gets rounded up to 10hrs)
    If C1=2 it means the client pays for rounded up 1/4hrs so if E1=9 and F1=10 they pay for 37 quarter hrs (9x4=36 quarter hours but the client used an additional 10 minutes which is rounded up to a quarter hr equaling 37. If they had used 18 minutes this would get rounded up to 38 quarter hours and equally if they used 35 minutes it would get rounded up to 39 quarter hours)
    If C1=3 it means the client pays by the minute so if E1=9 and F1=10 they pay 550mins (9x60+10)

    I can't work out how to write this as one nested IF statement, I've always struggled to get the right syntax and keep getting very odd results. Can anyone point me in the right direction?

  2. #2
    Administrator 6StringJazzer's Avatar
    Join Date
    01-27-2010
    Location
    Tysons Corner, VA, USA
    MS-Off Ver
    MS365 Family 64-bit
    Posts
    24,721

    Re: How to write this nested if

    I tried this on your examples and it worked:

    Formula: copy to clipboard
    Please Login or Register  to view this content.
    Last edited by 6StringJazzer; 07-17-2018 at 11:52 AM. Reason: corrected spelling of CEILING
    Jeff
    | | |會 |會 |會 |會 | |:| | |會 |會
    Read the rules
    Use code tags to [code]enclose your code![/code]

  3. #3
    Forum Expert
    Join Date
    11-27-2007
    Location
    New Jersey, USA
    MS-Off Ver
    2013
    Posts
    1,669

    Re: How to write this nested if

    Using the following formula:
    HTML Code: 
    You'll get these results:
    C1 E1 F1 G1
    1 9 10 10
    2 9 10 9.25
    3 9 10 9.166666667
    1. Click on the * Add Reputation if you think this helped you
    2. Mark your thread as SOLVED when question is resolved

    Modytrane

  4. #4
    Forum Expert
    Join Date
    11-27-2007
    Location
    New Jersey, USA
    MS-Off Ver
    2013
    Posts
    1,669

    Re: How to write this nested if

    The results in my response are in hrs.

  5. #5
    Forum Contributor
    Join Date
    11-20-2008
    Location
    UK
    Posts
    132

    Re: How to write this nested if

    Quote Originally Posted by 6StringJazzer View Post
    I tried this on your examples and it worked:

    Formula: copy to clipboard
    Please Login or Register  to view this content.
    That's perfect! Works like a charm. I've never used CEILING before or CHOOSE, very handy functions will have to remember them for the future.

    Many Thanks for the help.

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

    Re: How to write this nested if

    If that takes care of your original question, please select Thread Tools from the menu link above and mark this thread as SOLVED. Thanks.
    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.
    You can reward them by clicking on * Add Reputation below their user name on the left, if you wish.

    Forum Rules (updated August 2023): please read them here.

+ 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] Write Sub procedure to format excel and write case/if statement to text file
    By vbronton in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 04-06-2018, 08:26 AM
  2. Too Many Nested Levels - What's the PROPER way to write this formula?
    By teddystiles in forum Excel Formulas & Functions
    Replies: 6
    Last Post: 10-02-2015, 01:16 PM
  3. Replies: 2
    Last Post: 07-09-2015, 04:25 PM
  4. [SOLVED] How to write nested IF formula
    By spics89 in forum Excel General
    Replies: 5
    Last Post: 07-22-2012, 10:54 AM
  5. how to write a nested if formula with special conditions
    By novice2430 in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 08-19-2009, 08:55 PM
  6. Replies: 6
    Last Post: 01-14-2009, 06:59 PM
  7. How to write this 4 condition nested formula?
    By bortz in forum Excel General
    Replies: 3
    Last Post: 12-09-2005, 09:55 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