To set Data Validation for Years and Months

ravi123

New Member
Joined
Dec 25, 2015
Messages
11
Hi,

I'm at biggner level excel usage and trying to set data validation for Years (Primary Validation) and months (secondary validation). Wishes to select year from drop-down list and then relevant months, however unable to do this. I don't know what i am doing wrong on earth :mad:. Also want to get secondary validation (months) to be dynamic in nature so that only previous or current month showing not the coming months of 2017.
 

Excel Facts

Format cells as date
Select range and press Ctrl+Shift+3 to format cells as date. (Shift 3 is the # sign which sort of looks like a small calendar).
yearmonthtoday's date24/02/2017monthsmylist
2017janmonth namefeb01/01/2017janjan
01/02/2017febfeb
01/03/2017mar
01/04/2017apr
01/05/2017may
01/06/2017jun
01/07/2017july
01/08/2017aug
01/09/2017sep
B2 is a drop down using mylist01/10/2017oct
01/11/2017nov
mylist only populates if the dates below months01/12/2017dec
are earlier than K1 (todays date)

<colgroup><col span="9"><col><col><col span="3"><col><col span="3"></colgroup><tbody>
</tbody>
 
Upvote 0
In addition:

The data validation in D2 simply holds the year range; the data validation in D3 holds the formula as shown in E3.

Hope this helps


Excel 2016 (Windows) 64 bit
ABCDE
1YearMonthDV1DV2
22013120162
3201422
420153
520164
620175
76
87
98
109
1110
1211
1312
Sheet1
Cell Formulas
RangeFormula
E3=IF(YEAR(TODAY())=D2,OFFSET(B2,0,0,MONTH(TODAY()),1),B2:B13)
 
Upvote 0
In addition:

The data validation in D2 simply holds the year range; the data validation in D3 holds the formula as shown in E3.

Hope this helps

Excel 2016 (Windows) 64 bit
ABCDE
1YearMonthDV1DV2
22013120162
3201422
420153
520164
620175
76
87
98
109
1110
1211
1312

<colgroup><col style="width: 25pxpx"><col><col><col><col><col></colgroup><thead>
</thead><tbody>
</tbody>
Sheet1

Worksheet Formulas
CellFormula
E3=IF(YEAR(TODAY())=D2,OFFSET(B2,0,0,MONTH(TODAY()),1),B2:B13)

<thead>
</thead><tbody>
</tbody>

<tbody>
</tbody>


Hi Jorismoerings,

Thanks for stopping by and reverting with exact solution. I'm grateful to you for addressing my query precisely. Will like to ask you one more query, why we have used width as "1" in OFFSET function?
 
Upvote 0
why we have used width as "1" in OFFSET function?


I'm usually trying to have the function explain itself; with the OFFSET i'm creating an array which has the elements in the rows hence using the HEIGHT parameter and has 1 column of data hence using the WIDTH. But it's an optional parameter so you can leave it out.
 
Upvote 0

Forum statistics

Threads
1,215,514
Messages
6,125,263
Members
449,219
Latest member
daynle

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