Hello,
In an Excel spreadsheet, I used a nested IF statement in each cell to do this, but the number of variables has increased and I think I have to go VBA with it.
I have one cell that is assigned a cost factor. It is determined by checking a combination of 2-3 different cells. E.g., If bldg is T and Surface is Rock or Pavers, then use factor table A.
I have looked at setting up a Select Case to cover my criteria, but can I use a combination of cells that may change throughout the statement and how do I assign the VLookup to the cells? Do I use For...Each? At what time does the code execute? I need it to be updated at all times.
Example of data:
Bldg Type Surface Membrane
T Rock
O Liquid FA
T Pavers FA
O Modbit
O Bur
A few possibilities of criteria:
If Bldg is T and Rock then Lookup table 1
If Bldg is O and Liquid and FA, then Lookup table 2
If Bldg is T and Pavers or Stone, then Lookup table 3
If Bldg is O and Modbit or Bur then Lookup table 4.
I am new at using VBA in Excel and I don't understand how you assign things to a range of cells. Thanks in advance for an advice.![[lookaround] [lookaround] [lookaround]](/data/assets/smilies/lookaround.gif)
In an Excel spreadsheet, I used a nested IF statement in each cell to do this, but the number of variables has increased and I think I have to go VBA with it.
I have one cell that is assigned a cost factor. It is determined by checking a combination of 2-3 different cells. E.g., If bldg is T and Surface is Rock or Pavers, then use factor table A.
I have looked at setting up a Select Case to cover my criteria, but can I use a combination of cells that may change throughout the statement and how do I assign the VLookup to the cells? Do I use For...Each? At what time does the code execute? I need it to be updated at all times.
Example of data:
Bldg Type Surface Membrane
T Rock
O Liquid FA
T Pavers FA
O Modbit
O Bur
A few possibilities of criteria:
If Bldg is T and Rock then Lookup table 1
If Bldg is O and Liquid and FA, then Lookup table 2
If Bldg is T and Pavers or Stone, then Lookup table 3
If Bldg is O and Modbit or Bur then Lookup table 4.
I am new at using VBA in Excel and I don't understand how you assign things to a range of cells. Thanks in advance for an advice.
![[lookaround] [lookaround] [lookaround]](/data/assets/smilies/lookaround.gif)