Excel: The Basics of Data Validation and Conditional Formatting
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 a van loaded with goods. 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. 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. 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.
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 2010 without having to worry about duplicate numbers. Under Tom’s instruction, this versatile application had effectively posted a bouncer at the door to stop gate-crashing duplicates from 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.
In the Settings tab, Tom clicks the Allow drop down arrow and he selects Custom from the list. A formula box appears, and into this, Tom types the following:
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:
The value you entered is not valid
A user has restricted the values that can be entered into this cell.
Tom gets on with his data entry, and at the end of it all, he discovered that there were eleven duplicated numbers. Renumbering these was a lot easier than having to give fresh numbers to his entire stock, so Data Validation saved the day.
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. He hires out games from three different consoles, the Playbox, the WeeStation 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 that could assist Tom in this task, but instead, he opts to create a chart using Conditional Formatting, which is technically not a chart at all.
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 chart 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.
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 he 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 (18 Rentals)
WeeStation – D3 (33 Rentals)
X-Drive – D4 (27 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 is 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
Tom then jazzed up his chart by adding a bright background colour. He did this by selecting the group of cells beneath the text, and then adding a fill colour. He also gave each bar its own identity by changing the font colours. Now when he wants to update his chart, he simply copies the one from the previous week, and pastes it below, leaving a separating gap of one row. All he has to do then is amend the date and enter the three values relating to that week’s rentals. Excel does the rest.
Tom can see at a glance that the WeeStation 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 tutorial 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’.