Skip to main content

Excel: The Basics of Data Validation and Conditional Formatting

Not so daunting

Not so daunting

Young Tom showed signs of entrepreneurial adroitness when he started a neat little sideline in his father’s general store. Tom had read in the local newspaper that a small chain of entertainment rental outlets that hired out console games had gone bust, and there was to be a fire sale of all stock. There was no such outlet in the area around Tom’s father’s store, so he went along to buy up as much of the stock as he could afford.

Tom arrived back from the sale with almost a hundred games for the Playbox, Wee Station and X Drive consoles.. He was delighted with his haul, and he immediately set about logging and numbering the titles on Excel. As the stock came from rental stores, the cases already had stickered numbers attached, so in order to save time and effort, Tom decided to log the stock using these existing numbers.

Not long into his task, however, he came across a flaw in the plan when a second box number 22 came up. As the stock he bought had come from more than one outlet, some of the numbers on the cases were duplicated. It would be difficult to memorise which numbers had already been used, and stock items with identical numbers would cause no end of problems if they slipped through the net. Tom was faced with the prospect of starting from scratch, and applying fresh stickers and numbers to each item individually.

Duplication - there may be trouble ahead.

Duplication - there may be trouble ahead.

Data Validation

But Tom is a resourceful fellow, and he found a way around the problem. He used Data Validation to ensure unique values in a column. In doing this, Tom could get on with the task of entering the game details in Excel without having to worry about duplicate numbers. Under Tom’s instruction, this versatile application had effectively posted a gatekeeper to stop intruding duplicates entering the column. Here’s how he did it – it’s a simple process, so you might like to try it yourself on a blank worksheet.

Tom will be entering the number of each game into column B. He clicks the header to select the entire column, and then clicks the Data tab on the ribbon. He selects Data Validation, and from the drop down menu, he clicks Data Validation again. A dialog box appears.

Data validation dialog box

Data validation dialog box

In the Settings tab, Tom clicks the Allow drop down arrow and he selects Customised from the list. A formula box appears, and into this, Tom types the following:


After clicking OK, tom receives the following prompt:

This formula currently evaluates to an error. Do you want to continue?

He clicks OK, and that is the job done. To be sure that all is correct, Tom deliberately tries to enter a duplicate value into column B, but he finds this impossible, and he is given the following message:

Someone set a data validation rule on this cell, and the rule requires you to add information in a particular way.

The formula above relates to column B, For other columns, simply delete the letter B from the formula, and replace it with the letter of whichever column you are using. Here is a formula for column F.


Tom gets on with his data entry, and at the end of it all, he discovered that there were eleven duplicated numbers. Renumbering these is a lot easier than having to give fresh numbers to his entire stock, so Data Validation saved the day.

Data validation - can't go there

Data validation - can't go there

Conditional Formatting

Tom’s game rental sideline was a success, and it brought in a steady stream of cash. In order to maintain the flow, however, Tom became aware that he must buy in new releases to keep up to date. As mentioned, he hires out games from three different consoles, the Playbox, the Wee Station and the X-Drive, and he needs to know how well or otherwise each format is performing. To do this, he must keep a record of exactly how many rentals are taken out for each console.

Now, Excel has a multitude of charts and graphs that could assist Tom in this task, but instead, he opts to create a graph using Conditional Formatting, which is technically not a graph at all.

Scroll to Continue


Well, he was shown this trick back at college, and he is a sentimental soul.

Tom keeps track of his rental transactions by entering the figures into an Excel spreadsheet each Sunday evening. He uses Excel’s REPT function to create an at-a-glance bar graph that will show him how many times games from each console format have been hired that week. First of all, however, he must set up his basics. Again you might like to try this yourself.

The Formulae*

Column B is dedicated to the date, and column C lists the different game consoles. Column D is where it gets interesting, because this is where Tom will enter the number of game rentals for each console over the past seven days. To begin with, he enters the number of rentals into the following cells:

Playbox – D2 (21 Rentals)

Wee Station – D3 (31 Rentals)

X Drive – D4 (25 Rentals)

In the cells immediately to the right of these values (Column E), Tom applies conditional formatting to convert his data into a chart. In cell E2, he types the following formula:


This is a fairly simple formula, so let us examine it.

Tom is telling Excel to repeat the character(s) within the speech marks by the value in the cell preceding it; in this case D2. The character that sits within the speech marks is an uppercase, sans-serif letter I (Arial), which I find most visually suitable for this task, although just about any character could be used. For the other console formats, Tom will use the following formulae:

=REPT("|",D3) – in cell E3

=REPT("|",D4) – in cell E4

An effective at-a-glance graph

An effective at-a-glance graph

Finishing Touches

Tom then jazzed up his chart by adding a bright background colour. He did this by selecting the group of cells containing the text, and then adding a fill colour. He also gave each bar its own identity by changing the font colours.

The beauty of this little trick is that when he wants to update his chart, Tom simply copies the one from the previous week, and pastes it below, leaving a separating gap of one row. Excel copies the formulae, as well as the text, so all Tom has to do is amend the date and enter the three values relating to that week’s rentals. Excel automatically adds or deletes to make the new values.

Tom can see at a glance that the Wee Station is outperforming the other two formats, and so he buys in more games for that console.

So as you can see, some of the terminology associated with Excel is not nearly as daunting as it sounds. Excel is a far more powerful application than the examples above demonstrate, but I hope this short article has given you an idea of how Data Validation and Conditional Formatting are useful tools to have at your disposal.

*In all my years, I think this is the first time I have ever used the word ‘formulae’.

Related Articles