Category Archives: Excel

Passing a spreadsheet around between organizations has a hidden problem; one that can easily make trouble. And the trouble comes, not from the spreadsheet, but from the default date setting on the computer.

Excel uses the default date setting to interpret the order of date information. Whether its’ Month-Day-Year or Day-Month-Year, or even Year-Month-Day, that information comes from the OS date settings. These are settings that we don’t often think about once we’ve set them. And typically, they are the same throughout an organization.

But take the spreadsheet you’ve designed, that uses Month-Day-Year into a Day-Month-Year organization, and all sorts of problems crop up.

The first problem is that you might not notice immediately; if July 6, turns into June 7 – that might not jump out at you as a problem. If you are lucky, you’ll spot something weird about the 12th of Month 21 …

So how do you nail down those dates so they can’t shift? One strategy is to break up your date entry into your preferred format, and then rebuild the date using the DATE function.

The syntax for the DATE function is =DATE(year, month, day)

Using the Date function to reassemble a date from separate cells

Here you can see the DATE function is building a date from the values in three separate cells: A3, B3 and C3 and the formula looks like this =DATE($C3,$B3,$A3)

Another advantage of this strategy is that Data Validation can be applied to these cells; ie the day column can be restricted to whole numbers between 1 and 31, the month column to whole numbers between 1 and 12 and the year column as well. In the sample file I’m using, the column holding the complete date (D) is hidden from the user. They will only see columns A thru C. The complete (and correct) date is referenced in formulas.

An alternate strategy would be to use the DATE function to extract the correct order from a whole date typed into a cell. In this case you would need to rely on the users to enter the date consistently regardless of their date system. I would recommend a custom date format be applied and a comment to tell the user what the required date format is. Breaking the date up avoids this reliance on the user’s compliance.

The formula checks the position number of the cell generated by the base formula and sees if it is less than or equal to the number of values in each category in column A. It then returns the value of the category in each cell.

Because I wanted to put symbols in the cell like these examples.

Talking Heads waffle chartBombs waffle chart

I took that monster formula and made it into a named formula.

This made building the conditional formatting rules much easier to do(simply because the conditional formatting dialog is so cramped).

Lastly, I built a series of conditional formatting rules to change the background colour of the cell based on the value returned by the formula. For the waffles using symbols, the rule formats the colour of the font, instead of the background.

A couple of additional pointers

To create a perfect grid, switch the view in Excel to Page Layout View. Page Layout View uses the same measurement scale for both row height and column width. Set your measurements here.

For the symbol waffles, use the File> Options>Advanced> Display Options for this worksheetand turn off the display of gridlines. That way when you copy the waffle, the gridlines will be invisible.

Simple or Complicated?

Simple or complicated? It’s been my observation that anyone can make a subject sound complicated – but it takes real understanding of a topic to simplify it in a way that is meaningful.

This is why, when I saw this sample slide below from designer Julie Terberg, I sat up and paid attention. Here is a wonderful example of a chart that is simple in a beautiful and useful way. Immediately, you can see that an audience would find this chart easy to read and understand

Julie Terberg’s Button Bar Chart from her #SlideADayProject project

I paid even more attention when I saw the way that Neil Malek put together an Excel version of the chart. Neil introduces a clever technique using shapes in data labels. Here is the YouTube video:

Unfortunately, Neil’s clever technique is only available in Office 2016. I wanted to build the chart in Office 2010, for the benefit of my clients still using 2010.

Button Bar Chart Slide, in PowerPoint 2010

I think that in the end, I succeeded. If you are interested in building this chart, and like me you are restricted to Office 2010, then I have a few pointers for you.

Button Bar Chart Pointers

Data Labels in 2010 can not use shapes. Instead, I tweaked the Shadow setting for the label, by setting the colour to match the fill on the label and the size to 150%. I left all other settings to zero. Shaping the label this way means that you can never achieve the circle that Julie used in her example. Instead, the best you can do is a lozenge shape. You can modify this when you change the font size in the label.

But once you’ve used the Shadow to enlarge your button, you can’t use it to shadow the data label. I solved this problem with an old fashioned solution. I made two charts (a 2016 and a 2017 chart). The two charts are grouped together. Each chart has a data label for the year and a data label for the shadow. In the example below those labels are using the 1 values. The column labelled 2016 value is the length of the bar.

Button Bar Chart Data layout

The Shadow column must proceed the 2016 column or your shadow will wind up on top of the 2016 label. Also format your labels in that order as well, or the shadow will temporarily be on top of the 2016 label.

Format your shadow and label to the same font size.

The Chart Element selector on the Format Tab of the Chart Tools ribbon is your friend. Its’ really the only reasonable way to select the shadow data labels once they are under the visible label.

Link the label text to the cell in in Excel by using the formula bar and typing in the linking formula to the cell. This allows you to update the chart, by changing the text in the cell. A bit finicky to set up; but it will save a ton of time in the long run.

The best way to take this chart into PowerPoint is by copying/pasting the chart – as an image. Which means that you’ll need to presize the chart in Excel, so that text is not distorted by resizing once it is pasted into PowerPoint. Again, its a bit finicky – but worth it.

In PowerPoint, I created a layout, with text placeholders on the left and bottom of the slide.

Layout has text placeholders on left and bottom of slide

All in all, a pretty reasonable version of Julie’s stellar design.

If you want to follow Julie Terberg and Neil Malek on Twitter, you’ll find them here.

It’s that time of year again. Tax time. Now that I’ve made you sad, lets check out a formula which is very useful when adding up long columns of numbers (deductions anyone?)

Put the sum of the column at the TOP of the page, making it easy to find

When you have long columns of numbers of irregular length, it is often easier to have the totals display at the TOP of the page. That way, you don’t have to scroll all over the place to find them. The other advantage of this formula is that you can use it to keep an eye on your total as it accumulates, since you don’t have to know how many rows long the column will be.

The formula here is =SUM(OFFSET(A1,1,0,COUNT($A:$A),1))

Where the OFFSET & COUNT functions are used to create the range that will be summed.

Flash Fill is a new tool introduced in Excel 2013. Its a simple tool to handle a frequent problem. You have a small set of data and you need to break it apart into separate columns or join separate columns of data together.

Previously, I would have handled it with a series of text functions in Excel (LEFT, RIGHT, MID) combined with FIND and LEN if the data was complex enough. But if the data set is small, writing a formula sometimes seems like an overly complicated answer to a simple problem (why not just retype?).

Now Flash Fill is stepping in to help you handle this problem. If you give it a series of data (column orientation only) and an example of the pattern you want to extract, it will extract the data for you.

Flash Fill captures the first names only from the adjacent column

You can see once the second name is typed in the column adjacent to the list of full names, Flash Fill is able to see the pattern and offer all the first names in the list. Pressing enter autocompletes the action and the names are filled in. To do this, there can not be more than two blank columns between the source data and the resulting column. You can use the Ctrl + e shortcut to start flash fill.

You can click the Flash Fill icon to display the menu, accepting the suggestions will have all the names autocomplete.

The Flash Fill Menu

Here is an even trickier scenario, in the list above some names have two middle initials. Using the “default” flash fill means only the second initial will display in those names. However if I return to any of the names on the list (with two initials) and correct the example to two initials, all of the two initials examples will be extracted.

Flash Fill double initial example

I find that seriously impressive.

I can split data in a cell into multiple columns and I can also use Flash Fill to join multiple columns of data together.

Joining separate columns using Flash Fill

The same technique used above. Note that I’ve been able to add commas and periods to the text as well.

Using Flash Fill to apply formatting

In the same way, I can use Flash Fill to apply formatting, in this case putting a space between the first and second part of a postal code. You can also use it to format telephone numbers and date information.

Excel has been around for decades, so it isn’t surprising that there are many features tucked away under the hood. What is surprising is when a useful feature is lost and only careful archeology can bring it back to life.

Excel 4.0 had a rudimentary macro language, mostly using excel formula approaches to building functionality. This was replaced by the VBA programming language. But there are still useful little items tucked away in this early language that haven’t been replaced.

One of these is Get.Cell.

Get.Cell had a boatload of switches that allowed the user to pull information about the cell formatting and contents and most of these have been replaced by the Cell and Type functions in Excel.

But one piece of information that Cell and Type can’t tell you is whether your cell or cells contain formulas vs values and sometimes this is a very handy thing to know at a glance. For example, if you build a spreadsheet using formulas to estimate amounts; but then start to drop in values as more concrete information becomes available.

In this situation I like to format cells containing formulas differently from the cells containing values, so that I can see at a glance where my estimates are. Its’ handy to have the formatting change automatically, so I don’t have to remember what my rules are weeks or months later.

This is where Get.Cell shines. The syntax I’m going to use is

=GET.CELL(48,A1) – where A1 is the cell I’m going to reference.

The trick here is that Get.Cell is NOT entered in a cell, but instead as a named formula. After creating the named formula, I can reference it while applying conditional formatting. In this way, when the type of content in the cell changes the conditional formatting automatically updates.

Using a named formula in Conditional Formatting

Where does one find information about the Get.Cell function? Not from Microsoft or at least not easily from Microsoft.

Here is a version of a spreadsheet that I’ve been using for a couple of years to track and plan capital purchases. A number of people review this spreadsheet and I want to make it as easy as possible for them to read the spreadsheet. You’ll notice that the Budget year is highlighted in green and items being purchased in that year are highlighted as well. This is accomplished with our friend conditional formatting and the following spreadsheet functions:

This spreadsheet makes use of a helper column of formulas. Rows where the value equals TRUE are highlighted.

The Helper column holds formulas

Cells give a value of TRUE when there is a value for that row in the Budget Year selected in cell A1. You can see that 2017 has been selected as the Budget Year and that rows 9 and 20 have a value for that year and are highlighted as a result.

This looks for a match between the value in A1 and the Budget year headings which start in cell F2 and go to AU2 (the year 2033, which is incredibly optimistic – but that is another story). MATCH returns the number of the first itemin that array of cells that matches the value in A1. This is why even though there are two columns for every year (a Budget column and an Actual column) MATCH will only return the Budget column, as it is the first value to match.

So the result of MATCH($A$1,$F$2:$AU$2,0) is 9

However, if I actually want to capture the column I need to to add 5 to compensate for the fact I have 5 columns (A-E) before column F and the year headings begin. This is why I’m adding 5 in the formula.

MATCH($A$1,$F$2:$AU$2,0)+5 =14

In the next step I use ADDRESS and ROW to capture the address of the cell I’m testing.

ADDRESS(ROW(),14,3,TRUE))

ROW() captures the value of the row of the cell where the formula is written. If the formula is in A3, then row() returns 3.

Freezing panes is a basic tool to make a large spreadsheet easier to work with. In my social media spreadsheet I like to freeze the header row into position. Then no matter how far I scroll down the sheet, the columns are labelled.

To turn on frozen panes, select the cell below the row & column you wish to freeze into position. Since I don’t want to freeze any columns, I select cell A2.

Freezing Panes using the Active Cell position

Select the View Ribbon, Click on the Freeze Panesbutton, and choose Freeze Panes(or Freeze Top Rowin this scenario).

Freezing Panes Results

Now you can scroll for hundreds of rows, and each column is nicely labelled – no guessing!

The Select Visible Cells Only function is so useful, I like to add it to the Quick Access Toolbar (QAT) in Excel. These instructions are based on Excel 2010, but will be similar in all current versions of Excel.

Quick Access Toolbar Customization

The Quick Access Toolbar starts in the top right corner of the Excel window. The customize button is circled in red. Clicking on that button displays the menu shown below.

Move the QAT under the ribbon

The first change I like to make is to its’ position. I like to move it under the Ribbon, since there will be more room for buttons there. Over time I tend to fill the QAT up with frequently used tools.

After I move the QAT below the ribbon, I go hunting for useful commands to add. Click the More Commands… option and the Customize the Quick Access Toolbardialog opens up.

Customize the Quick Access Toolbar – Popular Commands

The dialog box defaults to Popular Commands. Try scrolling through this list and find the Format Painter. Press the Addbutton, to add it to the Quick Access Toolbar. This is a useful tool to have at hand!

By clicking on the Choose commands fromdrop-down list, a selection will be displayed.

Drop-down list of source commands.

Select All Commandsfrom this list. Hundreds of Excel commands will display, and this is where it is useful to know the name of the command you are looking for. Scroll until you find Select Visible Cells.

Finding the Select Visible Cells command

Select it, Click on the Addbutton, and click OK.

Simply select the cells you wish to copy and press the Select Visible Cellsbutton. Paste your information and only what you see will be pasted.