Back
Excel

A PivotTable Trick That Brings Data Validation to Excel Services

Today’s author: Dany Hoter, a product planner who works on the Excel Services team. 

Excel has a feature called Data Validation that controls the possible values a user might enter into a cell or a range of cells.

As you can see there are many options for validating data entry. The most popular is probably validating against a list of values. The list can be included in the validation definition or can be a region in the sheet referenced from the dialog.

Recently I saw an example created by a customer that validates input using a PivotTable instead of data validation. The idea is to use only the report filter area of the PivotTable and to use the values selected in multiple filter fields as inputs for a model:

In the example you see multiple input fields and when clicking the filter icon the user will see a list of values and can choose one.

The advantage of this method is easier maintenance of multiple lists of values used for validating multiple fields. The range that the PivotTable is based on looks a bit odd because usually PivotTables are based on rectangular ranges and not something that looks like this:

In order to avoid the “(blank)” value appearing in the PivotTable drop-down list of values, fill the last value in each category all the way down to the last row of the region:

Use of PivotTable for validation in Excel Services

So far I explained how a PivotTable could be used as a validation method in Excel. The impact of using this technique is not significant until we apply it to Excel services. Excel services does not support data validation and any workbook containing data validation will not be loaded by Excel Calculation Services (ECS). In addition, entering inputs to a model in Excel Services is not as user-friendly as Excel since values cannot be entered directly into cells. Using PivotTable filters for validation is fully supported in Excel Services and can solve these two problems. We have a friendly way to input values into a model and also to apply a validation against a list of values. The same example might look like this in the browser:

So if you are looking to build a spreadsheet that can be consumed by Excel Services and provides user-friendly, validated, input, give the PivotTable report filter a try.

Update: sample file can be found here.