+ Reply to Thread
Results 1 to 10 of 10

Complicated use of IF formula

  1. #1
    Registered User
    Join Date
    08-01-2012
    Location
    KL
    MS-Off Ver
    Excel 2010
    Posts
    37

    Complicated use of IF formula

    I'm managing calculation of water bills where different states have different water tariff & would really really appreciate if anyone can help me on this scenario.

    State A
    1st 50L usage charged at 1.00 per L
    Usage of 51L-100L charged at 1.20 per L
    Usage of 101L-150L charged at 1.40 per L
    Usage of 151L and above charged at 1.50 per L
    Eg. Usage of 125L would be charged at (50L x 1.00) + (next 50L x 1.20) + (last 25L at 1.40), giving 145.00

    State B
    Flat rate 2.00 per L

    State C
    1st 30L usage charged at 1.50 per L
    Usage of 30L and above charged at 1.70 per L

    I would have :
    Cell A : Name of Company
    Cell B : State (eg. State A)
    Cell C : Consumption (eg. 100L)
    Cell D : Charges (To insert formula here)

    I tried to ponder around but I could only make it by using IF formulae which is very very long.

    Tariff Sample.xlsx

    Many thanks in advance if anyone could help me with this!
    Last edited by donkeybusiness; 08-11-2012 at 05:38 AM.

  2. #2
    Forum Contributor bonny24tycoon's Avatar
    Join Date
    04-02-2012
    Location
    Hell
    MS-Off Ver
    Excel 2003 & 2007
    Posts
    405

    Re: Complicated use of IF formula

    Can you upload an example workbook with some comments for us to try??
    Thanks,

    Bonny Tycoon


  3. #3
    Valued Forum Contributor
    Join Date
    05-08-2012
    Location
    Georgia, USA
    MS-Off Ver
    Excel 2003, 2010
    Posts
    811

    Re: Complicated use of IF formula

    B3 is the Consumption
    B4 are the calculated charges

    NOTE:
    With this equation once the usage exceeds the threshold, all charges are at the new rate. For example, in State C if you use 31L, all 31L will be charged at 1.70 per L.

    =================================================
    If this is not what you had in mind, the formula needs to be changed to this:
    =IF(B2="A",IF(B3<=50,B3*1,IF(B3<=100,(B3-50)*1.2+50,IF(B3<=150,(B3-100)*1.4+110,(B3-15)*1.5+180))),IF(B2="B",B3*2,IF(B2="C",IF(B3<=30,B3*1.5,(B3-30)*1.7+45))))

    Attached is a simple spreadsheet for both approaches. Sample 1A is for the 2nd formula
    ============================
    A better approach would be to set up 3 lookup tables
    Attached Files Attached Files
    Last edited by K m; 08-09-2012 at 10:57 AM.
    Click on star (*) below if this helps

  4. #4
    Registered User
    Join Date
    08-01-2012
    Location
    KL
    MS-Off Ver
    Excel 2010
    Posts
    37

    Re: Complicated use of IF formula

    Yes.
    K m's formula is what I've got initially & it works well with 2 -3 states.
    The complication is I have like 8 - 10 states, where each state has different tariff.
    Which means the formula would be extremely long.

    Is there any possible way to 'shorten' the formula?

  5. #5
    Valued Forum Contributor
    Join Date
    05-08-2012
    Location
    Georgia, USA
    MS-Off Ver
    Excel 2003, 2010
    Posts
    811

    Re: Complicated use of IF formula

    The better approach is several lookup tables, one for each state. This way the formula can be shortened.

    More work on your part initially

    SUMPRODUCT may also work but others can help with that
    Last edited by K m; 08-10-2012 at 05:27 AM.

  6. #6
    Forum Expert Fotis1991's Avatar
    Join Date
    10-11-2011
    Location
    Athens(The homeland of the Democracy!). Greece
    MS-Off Ver
    Excel 1997!&2003 & 2007&2010
    Posts
    13,744

    Re: Complicated use of IF formula

    Quote Originally Posted by K m View Post
    The better approach is several lookup tables, one for each state. This way the formula can be shortened.

    More work on your part initially

    SUMPRODUCT may also work but others can help with that
    And of course, we need a sample workbook for this.
    Regards

    Fotis.

    -This is my Greek whisper to Europe.

    --Remember, saying thanks only takes a second or two. Click the little star * below, to give some Rep if you think an answer deserves it.

    Advanced Excel Techniques: http://excelxor.com/

    --KISS(Keep it simple Stupid)

    --Bring them back.

    ---See about Acropolis of Athens.

    --Visit Greece.

  7. #7
    Registered User
    Join Date
    08-01-2012
    Location
    KL
    MS-Off Ver
    Excel 2010
    Posts
    37

    Re: Complicated use of IF formula

    I could upload a sample workbook but I don't know how to upload one..

  8. #8
    Forum Expert Fotis1991's Avatar
    Join Date
    10-11-2011
    Location
    Athens(The homeland of the Democracy!). Greece
    MS-Off Ver
    Excel 1997!&2003 & 2007&2010
    Posts
    13,744

    Re: Complicated use of IF formula

    To attach a file, push the button with the paperclip (or scroll down to the Manage Attachments button), browse to the required file, and then push the Upload button.

  9. #9
    Registered User
    Join Date
    08-01-2012
    Location
    KL
    MS-Off Ver
    Excel 2010
    Posts
    37

    Re: Complicated use of IF formula

    I've attached the sample file in my 1st post

  10. #10
    Registered User
    Join Date
    08-01-2012
    Location
    KL
    MS-Off Ver
    Excel 2010
    Posts
    37

    Re: Complicated use of IF formula

    Any help??

+ 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