+ Reply to Thread
Results 1 to 4 of 4

If Statement with calculations based on data valadation list

  1. #1
    Registered User
    Join Date
    09-01-2011
    Location
    Blythe, AZ
    MS-Off Ver
    Excel 2003
    Posts
    28

    If Statement with calculations based on data valadation list

    I know the title is a mouthful but sadly, so is my dilemma.


    I need to create a formula within my sheet that will output a certain calculated figure based on the information within the spreadsheet.

    Column E is one way miles
    Column F is round trip miles
    Column G is "band" or otherwise the data validation drop down list
    Column H is the cost based on "if" statements

    What I'm trying to do is create separate equations with the cells in Column H that will produce a result based on what is selected in Column G.

    For example.

    If "Fixed" is selected in Column G, the cell needs to out put an equation that corresponds to the number of miles in Column E (either <30 miles, <50 miles, or >50, miles).
    If the miles are less than 30, Column F needs to be multiplied by $25
    If the miles are less than 50, Column F needs to be multiplied by $35
    If the miles are greater than 50, Column F needs to be multiplied by $40

    If "Long" is selected in Column G, the cells needs to do a simple equation =(F$*.50)+4.5

    If "Short" is selected in Column G, the cells needs to do a simple equation =(F$*.25)+4.5

    Using the list I've provided as an example, Column H should output the following results for Row 2
    If "Fixed" = 40
    If "Long" = 174.5
    If "Short" = 89.5

    It tries a forumula to get the "fixed" portion of the cell working (H17) but to no avail. Any help, tips or advice you can offer would be greatly appreciated.EHF Sample.xlsx

  2. #2
    Forum Expert NBVC's Avatar
    Join Date
    12-06-2006
    Location
    Mississauga, CANADA
    MS-Off Ver
    2003:2010
    Posts
    34,898

    Re: If Statement with calculations based on data valadation list

    Perhaps?

    =IF(G2="Fixed",LOOKUP(F2,{0,30,50},{25,35,40})*F2,IF(G2="Long",(F2*0.5)+4.5,IF(G2="Short",(F2*0.25)+4.5,"")))
    Where there is a will there are many ways.

    If you are happy with the results, please add to the contributor's reputation by clicking the reputation icon (star icon) below left corner

    Please also mark the thread as Solved once it is solved. Check the FAQ's to see how.

  3. #3
    Registered User
    Join Date
    09-01-2011
    Location
    Blythe, AZ
    MS-Off Ver
    Excel 2003
    Posts
    28

    Re: If Statement with calculations based on data valadation list

    Awesome!

    That worked for Short and Long but for some reason, fixed is returning really high numbers. Then I noticed it was multiplying by column f and once I tool that out, BINGO!

    You are my hero once again NBVC.

  4. #4
    Forum Expert NBVC's Avatar
    Join Date
    12-06-2006
    Location
    Mississauga, CANADA
    MS-Off Ver
    2003:2010
    Posts
    34,898

    Re: If Statement with calculations based on data valadation list

    Great... but you did say...

    If the miles are less than 30, Column F needs to be multiplied by $25
    etc...


    and that is what I did.

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

Tags for this Thread

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