Data Valadate and vlookup/offset/Index help

ArtPur

New Member
Joined
Nov 19, 2013
Messages
5
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 :smile:.
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.
 

Excel Facts

Format cells as currency
Select range and press Ctrl+Shift+4 to format cells as currency. (Shift 4 is the $ sign).

Forum statistics

Threads
1,223,882
Messages
6,175,165
Members
452,615
Latest member
bogeys2birdies

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top