Create a drop down calendar
The drop down calendar in the image above uses a "calculation" sheet and a named range. You can copy the drop-down lists and paste anywhere in the workbook but they have to be in the same order and adjacent.
You can select a year and month and a formula calculates the right number of days in the last drop down list, however if you choose "January" and day 31 and then selects February which is possible. The problem is that there are not 31 days in February.
You can use conditional formatting to hide the day when that scenario happens, that will clearly inform the user that the date is not valid. I will show you later in this post how to set it up. Here is how I created the drop down lists:
Create a drop down list for years
- Select cell A1
- Select tab "Data" on the ribbon
- Click "Data Validation" button
- Click "Data Validation..."
- Select tab "Settings"
- Select List in "Allow:" drop down list
-
Type in "Source:" window
2011, 2012, 2013, 2014, 2015
- Click OK!
Create a drop down list for months
- Select cell B1
- Select tab "Data" on the ribbon
- Click "Data Validation" button
- Click "Data Validation..."
- Select tab "Settings"
- Select List in "Allow:" drop down list
-
Type in "Source:" window
January, February, March, April, May, June, July, August, September, October, November, December
- Click OK!
Populate drop down list with unique distinct values sorted from A to Z
Question: How do I create a drop-down list with unique distinct alphabetically sorted values? Table of contents Sort values using [โฆ]
Populate drop down list with unique distinct values sorted from A to Z
Setup Sheet2
- Select sheet2
- Select cell A1
-
Type
=row()
in cell A1 and then press ENTER
- Copy cell A1 and paste down to cell A31
Create a named range
- Select tab "Formulas" on the ribbon
- Click "Name Manager" button
- Click "New..." button
-
Type
days
in Name: window
-
Type formula:
=Sheet2!$A$1:INDEX(Sheet2!$A$1:$A$31, DAY(DATE(Sheet1!A1, MATCH(Sheet1!B1, {"January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December"}, 0)+1, 1)-1))
in "Refers to:" window
- Click Close button
A dynamic named range grows automatically when new values are added and also shrinks if values are deleted. This saves [โฆ]
Create a drop down list for days
- Select cell C1
- Select tab "Data" on the ribbon
- Click "Data Validation" button
- Click "Data Validation..."
- Select tab "Settings"
- Select List in "Allow:" drop down list
-
Type in "Source:" window:
=days
- Click OK!
How to create a list of drop down calendars
- Copy cell A1:C1
- Paste down as far as needed.
The named range is dynamic, all drop down lists in each row is connected.
Hide day if date is invalid
The image above shows what happens if an invalid date is selected, conditional formatting hides the day to alert the user that the date is invalid. The formula in cell J2 checks if the date is valid or not.
- FALSE = Invalid
- TRUE = Valid.
Formula in cell J2:
The conditional formatting formula:
How to apply conditional formatting to cell D4
- Select cell D4
- Go to tab "Home" on the ribbon
- Click "Conditional formatting" button
- Click "New Rule..."
- Click on "Use a formula to determine which cells to format"
-
Type the formula above in "Format values where this formula is true:"
- Click "Format" button.
- Click tab "Font"
- Pick font color white.
- Click OK
- Click OK
Example
The image above demonstrates how to filter a table using the date picker and an array formula.
Array formula in cell B7:
To enter an array formula, type the formula in a cell then press and hold CTRL + SHIFT simultaneously, now press Enter once. Release all keys.
The formula bar now shows the formula with a beginning and ending curly bracket telling you that you entered the formula successfully. Don't enter the curly brackets yourself.
Copy cell B7 and paste to cell range B7:D9.
Tesh asks: How easy is it to modify this for recurring tasks (weekdays, weekly, monthly, quarterly and yearly) and maybe [โฆ]
Plot date ranges in a calendar part 2
I will in this article demonstrate a calendar that automatically highlights dates based on date ranges, the calendar populates names [โฆ]
This workbook contains two worksheets, one worksheet shows a calendar and the other worksheet is used to store events. The [โฆ]
Highlight specific time ranges in a weekly schedule
In a previous post I created a simple weekly schedule with dynamic dates, in this post I am going to [โฆ]
The calendar shown in the image above highlights events based on frequency. It is made only with a few conditional [โฆ]
Create dependent drop down lists containing unique distinct values
This article explains how to build dependent drop down lists. Here is a list of order numbers and products. We [โฆ]
Populate drop down list with unique distinct values sorted from A to Z
Question: How do I create a drop-down list with unique distinct alphabetically sorted values? Table of contents Sort values using [โฆ]
Apply dependent combo box selections to a filter
Josh asks: now if i only knew how to apply these dependent dropdown selections to a filter, i'd be set. [โฆ]
How to use an Excel Table name in Data Validation Lists and Conditional Formatting formulas
This article demonstrates different ways to reference an Excel defined Table in a drop-down list and Conditional Formatting. There are [โฆ]
Dependent drop-down lists in multiple rows
This article demonstrates how to set up dependent drop-down lists in multiple cells. The drop-down lists are populated based on [โฆ]
6 Responses to โCreate a drop down calendarโ
Leave a Reply
How to comment
How to add a formula to your comment
<code>Insert your formula here.</code>
Convert less than and larger than signs
Use html character entities instead of less than and larger than signs.
< becomes < and > becomes >
How to add VBA code to your comment
[vb 1="vbnet" language=","]
Put your VBA code here.
[/vb]
How to add a picture to your comment:
Upload picture to postimage.org or imgur
Paste image link to your comment.
@Oscar,
Here is a shorter Name Range formula that appears to work the same as the one you posted...
=Sheet2!$A$1:INDEX(Sheet2!$A$1:$A$31, DAY(DATE(Sheet1!$A$1, MONTH(Sheet1!$B$1&1)+1, 0)))
As a side note, you can change the $A$30000 reference in your posted Named Range formula to $A$31 and it will work just as well.
Rick Rothstein (MVP - Excel),
Thanks!!
i can't understand this6
=Sheet2!$A$1:29 ---->> not working
29=INDEX(Sheet2!$A$1:$A$30000,DAY(DATE(Sheet1!A1,MATCH(Sheet1!B1,{"January";"February";"March";"April";"May";"June";"July";"August";"September";"October";"November";"December"},0)+1,1)-1))
Try this formula:
The formula creates a cell reference to sheet 2, column A. The drop down list is then populated with values from sheet2, column A.
Please ....
=Sheet2!$A$1:INDEX(Sheet2!$A$1:$A$31,DAY(EOMONTH(DATE($A$1,MONTH(1&$B$1),1),0)))
This also works....