In this episode of Smart Use of Spreadsheets I focus on comparing spreadsheets and an example of basic set algebra. It is time for Techie Stuff. [On the background a nice tune starts and the smell of hot pizza and cola is entering the nostrils of the reader. That’s you.]
The Mood, the Mad, and the Muggle
Data is useless, unless it is used for other uses than only occupying space on a disk. Computer programs can be used to show the information on screen, but also to tag information. E.g. give me the phone numbers of pizzerias, which deliver at my home more than 6 meters below sea level. (The strange fact is that they do exist in the Netherlands. I say: “Cheese.” )
In this imaginary sanitised example I introduce a program, which compiles a list of all pizzerias in the neighbourhood of my home. It can export the list to a spreadsheet.
In the software development community there are really smart people. Another day I met a programmer, who refactored my pizza list program. The functionality remained the same, but the code was in better shape and maintainable. That last word sounded like music from my smartphone.
So I only had to test it (and like that). You know that thumb sign: =b. But comparing spreadsheets is quite boring and can affect my mood in a negative way (=p). Fortunately I do not have to be a wizard to get this tested fast and fully.
- Start the current version of pizza list program.
- Make a list and export it to spreadsheet with the name List Current Version.
- Start refactored version of pizza list program.
- Make a list and export it to spreadsheet with name List Refactored Version.
- Open the spreadsheet List Current Version.
- Rename the tab to Current Version.
- Make a copy of the worksheet to a new map.
- Save the map as Comparison Map spreadsheet.
- Open the spreadsheet List Refactored Version.
- Rename the tab to Refactored Version.
- Make a copy of the worksheet to Comparison Map.
Now it is time to add some smart things in the map:
- Add a third worksheet in the Comparison Map and call it Comparison Lists.
- Copy the heading from the worksheet Current Version to the first row of the sheet Comparison Lists.
- Use the wizard tool to make the following formula in cell A2 in the sheet Comparison Lists by clicking on the right cells:=IF(‘Current Version’!A2=’Refactored Version’!A2;”OK”;”NOK”)
- Copy the formula by placing the mouse on the right lower corner of the cell with the formula, press the left mouse button, move the mouse right until the most right cell of the heading of the table and release the left mouse button.
- Determine the number of rows in the tab Current Version or the tab Refactored Version.
- Select the cells with the formula in the second row in the sheet Comparison Lists, place the mouse on the right lower corner of the selected cells, press the left mouse button, move the mouse the previous determined number of rows downwards and release the left mouse button.
The formula has been copied to all cells.
And finally it is time to determine the results of the test:
- Select all cells in worksheet Comparison Lists.
- Add new worksheet Results.
- Paste by selecting Values.
- Search for “NOK”.
For a Few Pizzas More
My nifty pizzeria list program works as follows:
- Find all pizzerias in the Netherlands.
- Tag all pizzerias within 20 kilometres of my home.
- Put the tagged pizzerias on the list.
In this extension of the imaginary situation there was a customer, who wanted to know all the pizzerias in Amsterdam. So he asked my company to modify the program. And of course to test it. So the program will work as follows:
- Find all pizzerias in the Netherlands.
- Tag all pizzerias in Amsterdam.
- Put the tagged pizzerias on the list.
After a while the customer changed his mind he only wants to have one phone number for every pizza brand in Amsterdam. So no more pages of Best Praised Amsterdam United Pizza. Just one line of this brand in the complete list. So the programmer modified the program, that only the phone number, who has the first position in an alphabetical order from Z to A. The first version with complete Amsterdam list was good. This means, that every step was already tested except the tagging.
- Ask a programmer to make a list of every pizzeria in Amsterdam with the corresponding phone number by using a query in the database.
- Export the list to spreadsheet .
- Select the complete table without the heading.
- Sort the table first level on pizzeria name from A to Z and second level on phone number from Z to A. (Use the Sort function in the Data tab)
- Determine the minimal set of pizzeria names by removing duplicates. (Also a function in the Data tab)
- Start the single line version of Amsterdam pizzeria list program.
- Make a list and export it to spreadsheet .
- Compare the spreadsheets using the trick described from the previous paragraph.
NB some functions may not be available in all spreadsheet programs.
Who ordered the Q&A?
After three episodes about using spreadsheets in a smart way there is a Q&A for people, who want to get more in depth information.
So Use the For…..m Please.
See You Next Post.