+ Reply to Thread
Results 1 to 15 of 15

Formula based on varaibles

  1. #1
    Forum Contributor
    Join Date
    08-07-2013
    Location
    mo
    MS-Off Ver
    Excel 2010
    Posts
    453

    Formula based on varaibles

    I know this is more of a math question, but I nees to with a formula in excel to produce answer

    In B5 I have the number of nights staying at hotel
    In B6 I have the # of rounds the customer is going to stay
    In B7 is where I have to write a fomula that will produce the answer.

    Here is the prices to get the formula. I looks like if you stay two nights you get a free round. If you stay 1 night you get a discount.

    Both Nights & Both Rounds: $340
    Both Nights & 1 Round : $200
    One Night & 1 Round: $200
    1 Night: $100
    1 Round Golf: $140

    Thanks for help.... I have been working on this for hours and cant get it right

  2. #2
    Forum Guru TMS's Avatar
    Join Date
    07-15-2010
    Location
    The Great City of Manchester, NW England ;-)
    MS-Off Ver
    MSO 2007,2010,365
    Posts
    44,681

    Re: Formula based on varaibles

    One way:

    Formula: copy to clipboard
    Please Login or Register  to view this content.



    Regards, TMS
    Trevor Shuttleworth - Retired Excel/VBA Consultant

    I dream of a better world where chickens can cross the road without having their motives questioned

    'Being unapologetic means never having to say you're sorry' John Cooper Clarke


  3. #3
    Forum Contributor
    Join Date
    08-07-2013
    Location
    mo
    MS-Off Ver
    Excel 2010
    Posts
    453

    Re: Formula based on varaibles

    Wow, that worked.. Thanks, but I am looking for more of a formula, because what if they stay 16 nights or stay 4 nights and dont play any golf. I know I should be on a math forum somewhere.

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

    Re: Formula based on varaibles

    Here's another, just a little off the beaten path

    =CHOOSE(B5+1,140,CHOOSE(B6+1, 100,200), CHOOSE(B6, 200,340))

    Nevermind, thought it was just for the 2 nights. Thinking....
    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

  5. #5
    Forum Guru TMS's Avatar
    Join Date
    07-15-2010
    Location
    The Great City of Manchester, NW England ;-)
    MS-Off Ver
    MSO 2007,2010,365
    Posts
    44,681

    Re: Formula based on varaibles

    You're welcome. Thanks for the rep.


    Ah, but now you're asking a different question So, what if they stay 16 nights and don't play golf? How do you apply the discount(s)?

    Interesting that two nights plus one round costs the same as one night plus one round ... so, given you have the time, you can have a free night away. Is that intended?

    You need to define some rules ... no idea what they might be like. In simple terms, you could just multiply the number of nights by the room rate and add the number of rounds by the golf rate. That's your full/maximum rate. But how do you then discount it?

    You could have a matrix ... with golf rounds across the top (first row) and nights down the side (left hand column) and then use INDEX/MATCH/MATCH to pick a combination. Bit of a pain for say 20 nights by 20 rounds ... but you only have to set it up once.

    Regards, TMS

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

    Re: Formula based on varaibles

    Not enough information.
    With 1 night rnd of golf is 100, with 2 nights, second rnd of golf is still 140.
    with 3 nights would first 2 rds of golf be 100 and 3rd be 140?

  7. #7
    Forum Guru TMS's Avatar
    Join Date
    07-15-2010
    Location
    The Great City of Manchester, NW England ;-)
    MS-Off Ver
    MSO 2007,2010,365
    Posts
    44,681

    Re: Formula based on varaibles

    see the example attached
    Attached Files Attached Files

  8. #8
    Forum Contributor
    Join Date
    08-07-2013
    Location
    mo
    MS-Off Ver
    Excel 2010
    Posts
    453

    Re: Formula based on varaibles

    Every 2 nights you get 1 free round. If you are staying one night a round of golf is $100 (so discounted). So Three nights would look like this

    3 nights
    0 rounds: $300
    1 round: $300
    2 round: $300
    3 round: $400 (would be 2 nights with a free round and one night with a discounted round)
    4 round: ($400 (2 nights and two free rounds)

  9. #9
    Forum Guru TMS's Avatar
    Join Date
    07-15-2010
    Location
    The Great City of Manchester, NW England ;-)
    MS-Off Ver
    MSO 2007,2010,365
    Posts
    44,681

    Re: Formula based on varaibles

    So, if you stay three nights you get a free round of golf whether you want one or not? I'd rather have a discount on the room rate

  10. #10
    Forum Contributor
    Join Date
    08-07-2013
    Location
    mo
    MS-Off Ver
    Excel 2010
    Posts
    453

    Re: Formula based on varaibles

    Me to. I am puutingh this together for my company for a place they take us.
    Attached Files Attached Files

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

    Re: Formula based on varaibles

    I think you put the wrong value into 3 rounds, 2 nights. It should be 380. Otherwise that round of golf costs 60 and the next costs 220 (Avg = 140). The formula for B7 is

    =B5*100+B6*140-INT((B5+1)/2)*140

  12. #12
    Forum Contributor
    Join Date
    08-07-2013
    Location
    mo
    MS-Off Ver
    Excel 2010
    Posts
    453

    Re: Formula based on varaibles

    Wow, ChemistB, you are the man............................................................. Thanks

  13. #13
    Forum Guru TMS's Avatar
    Join Date
    07-15-2010
    Location
    The Great City of Manchester, NW England ;-)
    MS-Off Ver
    MSO 2007,2010,365
    Posts
    44,681

    Re: Formula based on varaibles

    Credit to ChemistB for the Math

    See the example

    Regards, TMS
    Attached Files Attached Files

  14. #14
    Forum Contributor
    Join Date
    08-07-2013
    Location
    mo
    MS-Off Ver
    Excel 2010
    Posts
    453

    Re: Formula based on varaibles

    Thank you. I am going to look like a rock star in this meeting later today thaks yall!!!

  15. #15
    Forum Guru TMS's Avatar
    Join Date
    07-15-2010
    Location
    The Great City of Manchester, NW England ;-)
    MS-Off Ver
    MSO 2007,2010,365
    Posts
    44,681

    Re: Formula based on varaibles

    Good for you. Let us know how it goes

+ 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. Replies: 9
    Last Post: 04-18-2013, 09:27 AM
  2. Replies: 0
    Last Post: 03-13-2013, 12:25 PM
  3. Replies: 2
    Last Post: 02-01-2013, 01:57 PM
  4. match, sum based on max. freight based on furthest distance formula.
    By simpson in forum Excel Formulas & Functions
    Replies: 12
    Last Post: 11-30-2012, 02:01 PM
  5. [SOLVED] Basic Question about varaibles
    By Adam in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 01-10-2005, 09:06 PM

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