Data validation in 2 columns

Tom1983

New Member
Joined
May 20, 2019
Messages
12
https://chandoo.org/forum/threads/data-validation-for-2-columns.42439/HI,

Looking for solution to one problem.
Problem is -we have number of countries in different regions like Europe,Africa etc.

I have data validation in col A and Col B...when I choose any region in col A it is also showing countries in other regions as well in col. B...which we don't want.

so what is needed is...if I select Europe (Col. A) then only those countries should show up in col B which lies in Europe region.

It should apply till cell A100 and Cell B100

Not sure how to attach excel file here.

Please same question has been raised in another forum as well Chandoo.Link

But no reply received so far.

Many thanks incadvance
 

Excel Facts

Excel Can Read to You
Customize Quick Access Toolbar. From All Commands, add Speak Cells or Speak Cells on Enter to QAT. Select cells. Press Speak Cells.
Not sure how to attach excel file here.
You could upload a sample workbook to a site like dropbox.com then put the link here.

I wrote a code to set up a dependent data validation, so it doesn't use formula just VBA. The code is a bit long but the set up is pretty easy.
Let me know you're interested in this approach.
 
Upvote 0
Thanks Gerald....I got answer to my post...Akuini...I guess formula will be better....it quit easy as wel.. by the way thanks for loking into it
 
Last edited:
Upvote 0
Ok, try this:
If it's suitable for your project then I can explain how to set it up if you need.
Basically you just need to adjust the code in this part:
(This is in my original example, see that it has been adjusted in your sample workbook.)

Code:
'=================================================================================================
'=============== YOU MAY NEED TO ADJUST THE CODE IN THIS PART: ===================================

'sheet's name where the list for data validation is located. [in the sample: sheet "sheet2"]
Private Const sList As String = "sheet2"

'table's name where the list for data validation is located. [in the sample: "Table1"]
Private Const sTable As String = "Table1"

'column number where data validation is located
Private Const sC1 As Long = 2  '[col B] for data validation 1
Private Const sC2 As Long = 3  '[col C] for data validation 2

'the helper column, first cell [if the helper column is D then it must be "D1"]
Private Const xH As String = "D1"

'the name range as the source of data validation
Private Const xN As String = "xName"

The workbook:
https://www.dropbox.com/s/ev6zerm3cj11jy0/Test(2).xlsm?dl=0
 
Upvote 0

Forum statistics

Threads
1,224,820
Messages
6,181,161
Members
453,021
Latest member
Justyna P

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