It has to be done without VBA.
I have a list of months to be filled in one cell, say A1. The options can be filled using Data Validation-List (=Months) which causes a dropdown to appear in A1. In cell B1 I enter a year number (for example 2000). Now I want C1 to contain a dropdown, the entries in which change on the basis of the data in A1 and B1. In my example, A1 offers the choices january, february, march, april, may, june, july, august, september, october, november and december.
If I select january or march or may or july or august or october or december (months with 31 days), I should get numbers between 1 and 31 as an option in C1.
If I select april or june or september or november (months with 30 days), I should get numbers between 1 and 30 as an option in C1.
If I select february, I must first check if an year is leap year with this formula:
=((MOD(B1;4)=0)*((MOD(B1;100)<>0)+(MOD(B1;400)=0))=1)
and based on result of this formula(TRUE or FALSE), I should get numbers between 1 and 28 (or 29 if is leap year) as an option in C1.
I have created lists, named Days30, Days31, Days28 and Days29. How can I use Data Validation to switch between those lists for my dropdown in C1?? I'm trying to translate this logic into Data Validation formula, but no luck:
If (A1 = "april" OR A1 = "june" OR A1 = "september" OR A1 = "november") Then
Days30
ElseIf (A1 = "february" AND leapyear = 1) Then
Days29
ElseIf (A1 = "february" AND leapyear = 0) Then
Days28
Else
Days31
End if