EXCEL VBA FOR POSSIBLE COMBINATIONS DEPENDING ON CELLS VALUES


R

rehasezer

Hello to all,

I am an excel vba newbie and could not solve my problems to build combinations depending on the values (or datas) at cells. The definition of my problem is in the following:

CELLS FOR COMBINATIONS SOURCE
Col-B Col-C Col-D
1 MinAdt MaxAdt Total
2 1 3 4

-------------------------------

Col-B&C Col-D&E Col-F&G Col-H&I Col-J&K Col-L&M Col-N&O
5 Infant(M) Child-1(M) Child-2(M) Child-3(M) Child-4(M) Child-5(M) Child-6(M)
6 From|To From|To From|To From|To From|To From|To From|To
7 0|02,99 03|06,99 07|12,99

* (M) means merged cells, "|" refers seperated cells (not merged)

* No ages defined (blank) in this table after column "H" but may happen according to hotel

The values of B2, C2, D2 may change with respect to room size and "Total Pax" may icrease 5, 6 or more based on the child capacity of room (it is not the total of cells B2 & C2).

At cells 7 ages of children are given (not more than 6 chd at table). So all the possible the combination should be as in below:

Col-B Col-C
10 1ADT+1CHD (0-02,99)
11 1ADT+1CHD (03-06,99)
12 1ADT+1CHD (07-12,99)
13 1ADT+2CHD (0-02,99)
14 1ADT+2CHD (0-02,99)(03-06,99)
15 1ADT+2CHD (0-02,99)(07-12,99)
16 1ADT+2CHD (03-06,99)
17 1ADT+2CHD (03-06,99)(07-12,99)
18 1ADT+2CHD (07-12,99)
19 1ADT+3CHD (0-02,99)
20 1ADT+3CHD (0-02,99)(0-02,99)(03-06,99)
21 1ADT+3CHD (0-02,99)(03-06,99)(03-06,99)
22 1ADT+3CHD (0-02,99)(0-02,99)(07-12,99)
23 1ADT+3CHD (0-02,99)(07-12,99)(07-12,99)
24 1ADT+3CHD (0-02,99)(03-06,99)(07-12,99)
25 1ADT+3CHD (03-06,99)
26 1ADT+3CHD (03-06,99)(03-06,99)(07-12,99)
27 1ADT+3CHD (03-06,99)(07-12,99)(07-12,99)
28 1ADT+3CHD (07-12,99)
29 2ADT+1CHD (0-02,99)
30 2ADT+1CHD (03-06,99)
31 2ADT+1CHD (07-12,99)
32 2ADT+2CHD (0-02,99)
33 2ADT+2CHD (0-02,99)(03-06,99)
34 2ADT+2CHD (0-02,99)(07-12,99)
35 2ADT+2CHD (03-06,99)
36 2ADT+2CHD (03-06,99)(07-12,99)
37 2ADT+2CHD (07-12,99)
38 3ADT+1CHD (0-02,99)
39 3ADT+1CHD (03-06,99)
40 3ADT+1CHD (07-12,99)


As being understood from the combinations table, the combination table should look up Min & Max adult numbers while running. The total can not exceed 4 including the children. So the maximum capacity of room are figured as 1+3 or 2+2 or 3+1. The recurence of same combination are omitted as well. If this can manage bye VBA will be perfect.

Thanks in advance.
 
Ad

Advertisements


Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top