+ Reply to Thread
Results 1 to 6 of 6

Possible to Calculate with 3 variables

  1. #1
    Registered User
    Join Date
    10-22-2018
    Location
    Turkey
    MS-Off Ver
    Office2010
    Posts
    84

    Question Possible to Calculate with 3 variables

    Hi all,

    My excel file is attached. Once I was supported by another forum to build Sheet Event procedure included in file. It is Ok to calculate with 2 variables (Accommodation Type & Board) but can not succeeed to calculate with 3rd variable (Room Type). How can it be reducted to calculate depending 3 variables (Room Type + Accommodation Type + Board)

    Thanks in advance for your kindest promts.
    Attached Files Attached Files

  2. #2
    Forum Expert XLent's Avatar
    Join Date
    10-13-2010
    Location
    Northumberland, UK
    MS-Off Ver
    various
    Posts
    2,704

    Re: Possible to Calculate with 3 variables

    just out of curiosity, would the below formula work for you, instead?

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


    modify delimiters etc per your local requirements (e.g. , to ; if nec.)

  3. #3
    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: Possible to Calculate with 3 variables

    XLent's solution is very insightful and an elegant example of what can be done with a formula. I would highly recommend adopting that solution.

    _____________________________

    I worked on your code before I saw the formula solution. Just for comparison I will include it here, with XLent's formula in D9.

    There are a lot of problems with this code. It is virtually unreadable. I basically rewrote it.

    Your formulas to calculate rates starting in row 50 are wrong. It refers to row 24, but should refer to row 18. This caused the row that referred to row 33 to be all zeroes. I fixed that.

    I also removed the blank lines from your rates to make locating the right rate easier.

    You also had BED & BREAKFAST repeated twice in the last set of rates, so I changed the last one to HALF BOARD.

    I also added formatting to make the rate sheet easier to read. You can easily remove that if you don't like it.
    Attached Files Attached Files
    Jeff
    | | |會 |會 |會 |會 | |:| | |會 |會
    Read the rules
    Use code tags to [code]enclose your code![/code]

  4. #4
    Registered User
    Join Date
    10-22-2018
    Location
    Turkey
    MS-Off Ver
    Office2010
    Posts
    84

    Re: Possible to Calculate with 3 variables

    Thanks both of you. I am an amateur trying to automate my job regarding my necessities, so lots of things to be learnt but gonna keep your advices always. Normally it is a very long procedure converting the sheets of hotels prices (tabs) format into the format in "CALC" sheet and very sure that have several mistakes in codes (I also sent another post today because my code can not achieve to select required sheet end of procedure).
    XLent's solution seems better than to solve via vba and I tested in many combinations gave the right calculation always. My ranges are dynamic may lead to 500-600 rows for some hotels but my periods (dates) which may vary in each hotel are always fixed in maximum 13 columns (D14:P14) with last date (here 31.10.19) included.

    I am sure XLent' solution will work in all probabilities but want to ask if may check start (01.04) & end date (31.10) before calculation. I mean if date is selected before 01.04 or after 31.10 can the formula precheck and give the sum blank at least to be rid of date mistakes in selection. Thanks again

  5. #5
    Registered User
    Join Date
    10-22-2018
    Location
    Turkey
    MS-Off Ver
    Office2010
    Posts
    84

    Re: Possible to Calculate with 3 variables

    Now I noticed that formula works excellent for this hotel but periods' rows are also dynamic must be started from "D15" but can be extended to "P15" maximum. How can the formula be fixed for such cases?

  6. #6
    Registered User
    Join Date
    10-22-2018
    Location
    Turkey
    MS-Off Ver
    Office2010
    Posts
    84

    Re: Possible to Calculate with 3 variables

    Please Login or Register  to view this content.
    Please Login or Register  to view this content.
    Dear Xlent I made a small revision now works perfect. By the way forget my last post because working even in extended periods just missed a cell adress while retyping. Thanks a lot again

+ 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] How can I calculate based on two variables
    By D2S in forum Excel General
    Replies: 4
    Last Post: 09-18-2017, 09:59 PM
  2. [SOLVED] Multiple variables to calculate a value
    By cruisinto in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 06-28-2014, 06:59 AM
  3. To calculate the value for two different variables changes
    By balalikowshik in forum Excel Formulas & Functions
    Replies: 1
    Last Post: 09-04-2013, 04:29 PM
  4. Calculate cost with three variables
    By Keltic in forum Excel General
    Replies: 3
    Last Post: 04-22-2012, 11:17 AM
  5. Calculate for three variables
    By SRodin in forum Excel General
    Replies: 2
    Last Post: 01-09-2012, 12:24 PM
  6. Calculate Yes / No Variables?
    By mycon73 in forum Excel General
    Replies: 4
    Last Post: 03-26-2010, 03:22 AM
  7. [SOLVED] calculate all possible combination from 10 variables
    By silvia in forum Excel Programming / VBA / Macros
    Replies: 7
    Last Post: 06-12-2006, 08:10 PM

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