What I have:
Sheet 1 has a list of tank_id's (no duplicates) called "Details" (Columns are Tank_id, Tank_Name, Nation, Turret, TArmor_front, TArmor_rear, TView_range..).
Sheet 2 has a list of Turrets and the specifications called "Turrets". (Columns are: Tank_id, Turret_id, Turret_Name, Armor_front, Armor_rear, View_range.)
I have created a table of the turrets called tblTurrets and named a range of all the turrets called allTurrets. I have named the Tank_id range as sTank_id_turrets and I have named the Turret_name range as sTurrets
There are 633 Tanks and 2000+ Turrets .
What I hope to accomplish:
I want a data lookup(DL) in $D$3 (the Turrets column) of the Details sheet to reference the tank_id in $A$3, of the Details sheet, and then compare it to the tank_id in the Turrets sheet. There might be up to 4 matches. Then populate the DL with the turrets names. Then when the Turret name is selected in the DL, to populate the cells to the right of it.
What I have used:
=INDEX(sTurrets;MATCH(A3;sTank_id_turret;0)) - works but doesnt get all the matches, only first one.
=VLOOKUP(A3;tblTurret;sTurrets;FALSE) - named range not found
=VLOOKUP(A3;allTurrets;sTurrets;FALSE) - currently evaluates to an error
=VLOOKUP(A3;sTank_id_turret;sTurrets;FALSE)- currently evaluates to an error
=OFFSET(sTurrets;MATCH($A$3; sTank_id_turret;0);0;COUNTIF(sTank_id_turret;$A$3);1) -
gets the right amount of matches, but not the first correct one. ie if the turrets names for tank_id 149 were 't34 mod, Cruizer Mk1, Cz03 LTvz35, Leophard Prototype A1 and Leophard Prototype A2. This formula omits t34 mod and then added in Porsche T169, which is for tank_id 150
These can be used in the formula1 of the DV:
1. What am I missing to load a complete list correctly?
2. Is there a way to load the last value in the list by default?
3. How do I populate the cells to the right of the DV?
Any help with this will be appreciated.
Sheet 1 has a list of tank_id's (no duplicates) called "Details" (Columns are Tank_id, Tank_Name, Nation, Turret, TArmor_front, TArmor_rear, TView_range..).
Sheet 2 has a list of Turrets and the specifications called "Turrets". (Columns are: Tank_id, Turret_id, Turret_Name, Armor_front, Armor_rear, View_range.)
I have created a table of the turrets called tblTurrets and named a range of all the turrets called allTurrets. I have named the Tank_id range as sTank_id_turrets and I have named the Turret_name range as sTurrets
There are 633 Tanks and 2000+ Turrets .
What I hope to accomplish:
I want a data lookup(DL) in $D$3 (the Turrets column) of the Details sheet to reference the tank_id in $A$3, of the Details sheet, and then compare it to the tank_id in the Turrets sheet. There might be up to 4 matches. Then populate the DL with the turrets names. Then when the Turret name is selected in the DL, to populate the cells to the right of it.
What I have used:
=INDEX(sTurrets;MATCH(A3;sTank_id_turret;0)) - works but doesnt get all the matches, only first one.
=VLOOKUP(A3;tblTurret;sTurrets;FALSE) - named range not found
=VLOOKUP(A3;allTurrets;sTurrets;FALSE) - currently evaluates to an error
=VLOOKUP(A3;sTank_id_turret;sTurrets;FALSE)- currently evaluates to an error
=OFFSET(sTurrets;MATCH($A$3; sTank_id_turret;0);0;COUNTIF(sTank_id_turret;$A$3);1) -
gets the right amount of matches, but not the first correct one. ie if the turrets names for tank_id 149 were 't34 mod, Cruizer Mk1, Cz03 LTvz35, Leophard Prototype A1 and Leophard Prototype A2. This formula omits t34 mod and then added in Porsche T169, which is for tank_id 150
These can be used in the formula1 of the DV:
Code:
'Turrets
With Sheet1.Range("D3").Validation
.Delete
.Add Type:=xlValidateList, AlertStyle:=xlValidAlertStop, _
Operator:=xlBetween, Formula1:="=OFFSET(sTurrets;MATCH($A$3; sTank_id_turret;0);0;COUNTIF(sTank_id_turret;$A$3);1)"
.IgnoreBlank = True
.InCellDropdown = True
.InputTitle = ""
.ErrorTitle = ""
.InputMessage = ""
.ErrorMessage = ""
.ShowInput = True
.ShowError = True
End With
1. What am I missing to load a complete list correctly?
2. Is there a way to load the last value in the list by default?
3. How do I populate the cells to the right of the DV?
Any help with this will be appreciated.