With dependent data validation, you can make one drop down list depend on the selection in another cell.
For example, select Vegetables as a category in column B, and you’ll see a drop down list of vegetables in column C.
Excel tips and tutorials
With dependent data validation, you can make one drop down list depend on the selection in another cell.
For example, select Vegetables as a category in column B, and you’ll see a drop down list of vegetables in column C.
If you’re building an Excel workbook, in which users with basic Excel skills will enter data, would you create a worksheet data entry form?
In the screen shot below, you can see an example.

Or, do you prefer to build an Excel UserForm?
In the screen shot below, you can see a simple UserForm.

With the worksheet method, you can
An advantage is that you’re using built-in Excel features, like data validation and formulas, so you can reduce the development time.
The UserForm method takes longer to develop, because you’re adding another layer to the project. Advantages to this method include:
Both methods work well, and can be customized to be user-friendly and fool-resistant (nothing in Excel is fool-proof!) Programming would be required in both versions, to help with navigation, and to move data to the storage worksheets.
Which method would you use?
____________
In Excel 2007 and Excel 2010, you can use icon sets in conditional formatting. There are built-in icon sets, and in Excel 2010 you can Customize Excel Conditional Formatting Icons, to some extent. Here’s how to do that, and a workaround to create icons on the worksheet instead.
Continue reading “Customize Excel Conditional Formatting Icons”
Data validation is one of the best features in Excel. You can use it to create drop down lists, or limit what users can enter in a cell.
Unfortunately, data validation isn’t perfect, or foolproof. Users can get around the limits, by pasting data into the cell, or by using the Clear All command in a data validation cell.
Someone sent me a question this week, asking how to trap input errors, despite these data validation failings:
In this example, an order form has two cells for dates – an Order Date, and a Delivery Date. To ensure that a date for the current year is entered, you can use formulas in the data validation, to set a minimum and a maximum date.
Start Date formula: =DATE(YEAR(TODAY()),1,1)
End Date formula: =DATE(YEAR(TODAY()),12,31)

If you’re concerned that users might paste values into the cell, or clear the data validation, you can add a formula check, to ensure that a valid date was entered.
In the order form, a date check formula is entered in column G, which can be hidden.
The formula in cell G9 is:
=OR(C9=””,YEAR(C9)=YEAR(TODAY()))
The formula is copied down to cell G10, and the result is FALSE, because the date in C10 is not in the current year.

In the Invoice total cell, the formula result is “Invalid Date”, if either of the date check cells contains FALSE. If both dates are in the current year, the total sum is shown.
Here is the formula from the Invoice Total cell:
=IF(COUNTIF(G9:G10,FALSE),”Invalid Date”,SUM(E13:E17))

Instead of a formula check, there are other ways to ensure that users enter valid data.
For example, you could use Excel VBA to check specific cells before printing, and cancel the printing if the entries aren’t valid.
Have you used other methods to ensure that users don’t ignore your data validation cells?
____________
If you’re building a new city, or plotting world domination, you’ll need a powerful project management tool, such as Microsoft Project.
For smaller projects, you can list your tasks in Excel, and create a Gantt chart, to show the timeline. Here’s how you can do simple project planning with Excel Gantt chart – watch the video and there are written steps too.
Continue reading “Simple Project Planning With Excel Gantt Chart”
With Excel data validation, you can create drop down lists on a worksheet. However, the font size is very small, and can’t be adjusted, and you can only see 8 items at at time.
With Excel VBA programming, you can add a ComboBox to the worksheet, to show the data validation list.
In the ComboBox, you can control the font size and the number of visible items in the list.

Although this technique works nicely in Excel 2007, and earlier versions, you might have a problem with the ComboBox size in Excel 2010.
In the screen shot below, the ComboBox is about 1/4″ wide, instead of filling the entire cell.

In other workbooks, the ComboBox is so narrow that you can’t see it at all. That’s not too helpful a feature!
Fortunately, the problem is easy to fix in Excel 2010, if you follow these steps.
On the Developer tab, click the Design Mode command.

To select the ComboBox, type its name in the Name Box, and press Enter

On the Ribbon, under Drawing Tools, click Format, and click the Dialog Launcher for the Size group.

In the Format Shape dialog box, in the Size category, remove the check mark for Lock Aspect Ratio, and click OK
That should fix the ComboBox sizing problem!

To see the steps for changing the Size setting in Excel 2010, you can watch this short Excel video tutorial.
___________
If you work with data in Excel, you know what a mess it can be. I help my customers clean up data that they’ve imported from another computer system, or from reports received from another department or group.
Those files can be filled with spelling mistakes, strange abbreviations, extra spaces or missing punctuation.
Recently, we saw how you can use Excel Slicers, to filter fields in one or more pivot tables. This week, we’ll use a macro to move a pivot table slicer.
In the comments of the previous article, James asked how to keep those Slicers from overlapping the pivot tables.
One way to fix the problem of sliding Slicers is to automatically move the Slicers, any time the pivot table is updated.
To do that, you can use the PivotTableUpdate event, and a macro that moves the Slicer to the right side of the pivot table.
Each Slicer has a caption, and you can refer the the Slicer by that caption in the Excel VBA code.
In this example, the Slicer has a caption of “Region”, which is shown at the top of the Slicer.
The caption is also visible on the Excel Ribbon’s Options tab, when the Slicer is selected.

Here is the sample code that I used.
This macro moves a pivot table slicer to the right side of the pivot table, any time the pivot table is updated.
Note: This code is stored on a regular code module.
Sub MoveSlicer()
Dim wsPT As Worksheet
Dim pt As PivotTable
Dim sh As Shape
Dim rngSh As Range
Dim lColPT As Long
Dim lCol As Long
Dim lPad As Long
Set wsPT = Worksheets("PivotSales")
Set pt = wsPT.PivotTables("PivotDate")
Set sh = wsPT.Shapes("Region")
lPad = 10
lColPT = pt.TableRange2.Columns.Count
lCol = pt.TableRange2.Columns(lColPT).Column
Set rngSh = wsPT.Cells(1, lCol + 1)
sh.Left = rngSh.Left + lPad
End Sub
In the code, a variable (pt) is set for the pivot table.
The code counts the columns in the pivot table’s TableRange2 range, which includes the Report Filters area. (TableRange1 does not include the report filters.)
The code adds 1 to the column number that the last pivot table column is in.
A variable (lPad) sets the padding number — how much the Slicer will be moved to the right. In this example, the variable is set to 10
Finally, the Slicer is positioned, in the column to the right of the pivot table. In that column, the Slicer’s left side is indented by the padding amount.
The following code should be copied to the pivot table’s worksheet module.
It will run the macro to move a pivot table slicer (MoveSlicer), any time the PivotDate pivot table is updated.
Private Sub Worksheet_PivotTableUpdate(ByVal Target As PivotTable)
If Target.Name = "PivotDate" Then
MoveSlicer
End If
End Sub
To see how the macro to move a pivot table slicer works, you can download the Excel Slicer Move Code sample workbook. The file is in xlsm format, and is zipped. You’ll have to enable macros, to test the code.
_______
This product is no longer available.
For the latest Excel courses, Excel books and Excel tools, go to the Debra’s Excel Picks page, on my Contextures website
[Latest update: July 27, 2016] With a bit of Excel VBA programming, you can change an Excel data validation drop down list, so it allows multiple selections. This post is a roundup of articles on how to set up multiple selection Excel drop down lists.
Continue reading “How to Set up Multiple Selection Excel Drop Down”