Excel: Calculations with Time

We talk about calculations with dates in Advanced Formulas training (hooray for DateDif!). Working with time in Excel can be a bit trickier. I have seen people give up when formulas don’t work initially, but sometimes all that is needed is a change in formatting. Let’s see how we can work with time in a common example.

Exercise File

To follow along, download the exercise file here: TimeCalcExercise

  • In this file is a list of times that you attended some fictional February meetings. You want to figure out how much time you spent in meetings last month.
  • Note that there are two sheets in this workbook: February Meetings, which is your challenge, and Solution, so you can check your work as we go.

Number Formats

You are going to see that the formulas themselves are going to be very simple: basic addition and subtraction. The real key with times is the Number Format.

We are going to be using several Custom number formats. In the custom time formats, h stands for hours, and m for minutes.

  • h:mm AM/PM: 12 hour time, indicated by AM/PM, for example 11:00 PM
  • h:mm: 24 hour time, not including AM/PM, for example 11:00.
  • [h]:mm: Elapsed time, beyond a 24 hour clock. With this you are adding total number of hours, not adding hours to a clock of revolving time.

Start and End Time

The first thing we should do is fix up the start and end time formatting so Excel will know what we are trying to calculate. I created a couple helper columns in Columns C and D called Extract Start and Extract End. Columns A and B are a common format that happens when you export time from other programs.

 

Extract Start and End Time with Flash Fill

There are a number of ways you might chose to do this, but as a fan of Flash Fill, that is the route I would like to take.

  1. Create a pattern: click into C2 and type 9:00 AM (from A2)
  2. Select C3 an type 11:00 AM (from A3)

Cells C2 and C3 have times entered. Cell C4 selected:

  1. Select C4. Go to the Home tab, Editing Group, Fill Dropdown an select Flash Fill

Flash Fill Selected

This should complete the rest of Column C. If it doesn’t, double check that you have established a pattern that matches what you are seeing in Column A.

Complete Column D the same way, extracting the end time from Column B.

Check Number Format

Let’s check the number format for columns C and D.

  1. Select C2 through D32.
  2. In the Home tab, Number group, click the More arrow in the lower right.Number Group, More button
  3. The Type should display as h:mm AM/PM. If it doesn’t you can type it in manually, as it is listed below. This means you are view time in a way most of us are familiar with: for example, 12:30 PM.Number Forat View: h:mm AM/PM

We are going to revisit this number format area again soon, so stay tuned.

Calculating Time Spent in Each Meeting

Let’s calculate the time spent in each meeting, and then we can move on to calculate a grand total.

Subtracting Time

Column E, Total Time, is meant to calculate the time spent in each meeting. This is going to be a simple subtraction.

  1. Select Cell E2.
  2. Type =D2-C2 . You can also select cells D2 and C2 as you are creating the formularather than typing the names of the cells.
  3. Press enter to calculate.

Formula entered as described

4. Auto Fill the rest of the column, either by clicking and dragging or double clicking on the auto fill handle.

Adjust Number Formats

Let’s check the number format of Column E. Excel may have assumed that you wanted to use the same number formatting as C and D, but remember that includes AM and PM, which isn’t relevant for Column E.

 

  1. Select Cells E2 through E32.
  2. In the Home Tab, Numbers group, press the More button at the lower right.Number Group, More button
  3. This time, you want the number format to be simply h:mm. So no AM/PM necessary. Make sure you are on the Custom category.

    Click into the Type field and type h:mm (or find it in the type list).

type: h:mm entered as described above

Calculating Grand Total

  1. In Cell A33, type Grand Total.
  2. Select Cell E33: This is where we are going to calculate the total time.
  3. In the Home tab, Editing group, select the AutoSum dropdown and select Sum to add all the times in column E.

AutoSum Dropdown, Sum selected

Grand Total Formatting

Something is not quite right about our Grand Total.

Grand Total Displayed

This is all about number formatting. This Sum is displaying in the same format as the rest of column E: h:mm. This means Excel is adding the time on a 24 hour clock, which is not what we intended.

Let’s make one more number formatting adjustment.

 

  1. Go back to your Number Format options, just like above.

 

  1. In the Type, type square brackets [ ] around the “h.” This will send the message to Excel that you want a total elapsed time… beyond the 24 hour clock. So it will look like [h]:mm

Type listed as [h]:mm

Now the total elapsed time is showing in hours and minutes.

Time elapsed now displays correctly

Perfect! So it looks like you have spent almost 36 hours in these fictional meetings last month.

Solution Sheet

Did you get lost somewhere along the way? Double check your answer with the Solution sheet in the exercise file.

Thoughts?

Do you have a use for calculating time in your day to day spreadsheets? Do tell!

Congratulations, Power Users!

Congratulations to our newest Power Users! For the full gallery, and more information about the WSU Microsoft Office Power User Program, please visit: wichita.edu/poweruser

Catherine Lawless

Catherine Lawless

Jackie Boyles

Juanita Fonseca-Rodriguez

Krista Searle

Jackie, Juanita and Krista

Exciting News: Digital Credential for WSU Power Users

Friends, I have an exciting announcement about the WSU Microsoft Office Power User Program.

Digital Credential for Power Users

Thanks to our industrious colleagues at Instructional Design and Access, there is now an official digital credential for WSU Microsoft Office Power Users!

What does this mean?If you become a WSU Microsoft Office Power User, one of these will be yours!

 

Power User Credential

(The flash in the corner of the image is in honor of Flash Fill! Isn’t it beautiful??)

Email Incoming…

Once you become a Power User, you will receive  an email from Credly that you have been awarded a credential. It will look something like this:

Email from Credly

To claim your credential:

  1. Select Get Started. You will be taken to a log in screen with your name and email already populated.
  2. Create a Password and check the appropriate boxes if you agree to terms.
    Create Password
  3. Click Sign Up Now.
    (p.s. if you already have an account with Credly, you can skip steps 2 through 4 and simply click the Login button underneath.

That is it! You will be taken to a log in screen showing your new credential. If you would like, you can share your new credential on social media with the share buttons on the left:

 

More options

Once you have created your Credly account, you can log in any time at Credly.com.  From here you can share or download your new credential any time.

  • From the main account screen, your credentials are visible. Account Screen
  • Hover over the Power User credential until options appear. The one on the right is sharing options.

Options

Click on the sharing options to see the ability to share your credential on:

  1. Facebook
  2. Twitter
  3. LinkedIn
  4. Download a digital version of the image (you can use it in your signature!)

Share Options

That is the latest and greatest from Power User Land! Congratulations to all the powerful Power Users (and future Power Users). See you in training…

Congratulations, Power Users!

Congratulations to our newest Power Users! For the full gallery, and more information about the WSU Microsoft Office Power User Program, please visit: wichita.edu/poweruser

Julie Brin

Julie Brin

Julie Clinesmith

Chris Darnell

Crystal Dilbeck

Taylor Moore

Jessica Torres

Freh Wuhib

True Colors: Optimizing Charts for Readers with Color Vision Deficiencies

Hey, would you take a look at this chart and let me know what you think? I am particularly concerned about the sales figures I marked in red.

Chart filtered for red green color blindness. All colors appear murky green and indestinguishable

Don’t adjust your screen. You are viewing this chart through a filter that simulates the most common type of color blindness. We often have the best intentions when we try to draw attention to an element in a chart by marking it red, or by contrast to show that all is well by marking something green…  But trust me, this is the sort of thing that can ruin someone else’s day, and it is so easy to fix.

About Color Blindness

According to the NIH, color blindness or color deficiency affects around 8% of the male population and 0.5% of the female population. This means that, if your document will be viewed by 1000 people, around 45 of them will have some form of color deficiency. If you are sending it across campus, this could easily translate to several hundred people who will be affected.

It is worth noting that color deficiency is a spectrum; people can have mild to severe forms of color blindness, and not all forms of color blindness involve the same colors. The most common type of color blindness involves deficiencies in discerning the colors red and green.

A common misconception among those who are not color blind is that if someone has red/green color blindness, they only have trouble with the colors red and green. However, these deficiencies can easily affect other colors as well; for instance, maroon and brown can look identical to people with red/green color deficiencies… after all, maroon is just brown with a touch of red. In other words, it is not just the colors red and green themselves, but also those colors within other colors. It’s like an inception of color… (I still don’t understand that movie).

Troublesome Charts

Let’s take a look at a couple examples… (Disclaimer: both charts are created with entirely fictional data for purposes of illustration of chart features).

Pie chart using purple and blue to distinguish

At first glance, this chart looks great! I think I am clearly demonstrating that so many students (95%!) are happy on campus. But let’s run this through a red/green color blindness simulator…

Same chart filtered for red green color blindness: all appears purple

Wait. What is going on?? How many students are happy? Who is unhappy? Someone is 95%, but which one?

Let’s look at another.

Schools distinguished by red and green lines

We think we did a good job of drawing attention to Anthopology’s interest numbers by marking them in red…. But here is how the same chart filtered for red/green color blindness:

Same chart filtered for red/green, all lines appear green

Oh man. Maybe we didn’t do such a good job…

What You Can Do

  1. Never Use Color Alone to Convey Meaning

“Wait, are you saying I can’t use color anymore?” Of course you can! But don’t make color the only way someone can discern what is going on.

Think about incorporating labels, tables and textures in your charts (see below for some examples).

  1. Use Color Blindness Simulators to Test Documents

There are several simulators available online to help you do a final check on images or charts in your document. Here are a couple I have been using:

  • Color Oracle: This site has a free download that allows you to filter your entire screen with a couple clicks, and see how different documents would look with different types of color impairment.
  • Coblis: Color blindness simulator: upload an image to this site to see how it would look for different types of color impairments. For charts, you may have to take a screen shot so you will have an image to upload.
  • Windows 10: the settings of Windows 10 also has a color blindness simulator in settings. Go to Settings and search for Color Filter to find it.Windows 10 settings
  1. Utilize Monochromatic Color Sets

If there are only a few variables in a chart, contrast can be helpful. Regardless of a color that is perceived, gradations in color can almost always be detectable to your viewers. Monochromatic palettes consist of the same color with different gradations of lightness or darkness. See below for an example with a pie chart.

  1. Color Blind Friendly Palettes

If you are feeling fancy, there are some tried and true color-blind friendly palettes out there. Just make sure you are still not conveying meaning with color alone, because no palette can address all types of color blindness. Here is a page with some cool options, and interesting general information: Color Friendly Palettes

Exercise File

If you would like a challenge, try fixing some of the Charts in this exercise file. There are two sheets in the workbook with problematic charts and two sheets with possible solutions. That being said, there are many ways you could solve the puzzle of making these charts more accessible.

OfficeBytesColorExercise

Let’s Fix Those Charts!

If I went through all the ins and outs of chart creation, this would be much more than a byte, so please do come to my Pivot Tables, Charts and Pictures training if you get really stumped (or attend anyway, because it is a blast!)

Below is a summary of how I approached fixing the problem charts.

Chart 1

Chart 1 was this guy:

Pie chart using purple and blue to distinguish

I did two things to this chart:

  1. Utilized a monochromatic color set
  2. Added data labels

The result is conveying the same information, but the look is a bit different.

Pie chart now monochomatic yellow with labels

Running this chart through the red/green color blindness simulator (or even converting it to greyscale) it is still understandable.

Pie Chart looks mostly the smae with filter

Below are the steps I took.

Monochromatic Color

  1. Click on the chart to select it.
  2. Press the paintbrush button on the right side of the chart to access Style and Color options.
  3. Select color.
  4. Select a monochromatic color set (I picked yellow).
    Steps 1 through 4 illustrated

Data labels

  1. Click on the chart to select it.
  2. Press the + button on the right side of the chart for Chart Elements.
  3. Check the box next to Data Labels.
    • Don’t forget you can press the arrow to the right of Data Labels to access more options, like the location and appearance of the labels.Data Labels

Chart 2

Chart 2 was the fictional subject interest chart:

Schools distinguished by red and green lines

To fix this chart,  I added two things:

  1. Data labels  (see above)
  2. Data table at the bottom of the chart.

Line Chart now has labels and a table underneath

Though I didn’t change the colors, running this through a red/green color blindness simulator I can tell that people can perceive the difference between the lines with their labels; and as a backup, they could reference the table underneath.

Chart now understandable even though colors are all green

I covered data labels in the previous example.  Below is how you can insert a data table.

Data Tables

  1. Click on the chart to select it.
  2. Press the + button on the right side of the chart for Chart Elements.
  3. Check the box next to Data Table. Don’t forget you can always click on the arrow to the right of any of the chart elements to see more options.

Data Table

Tell Me About Your Experiences

What do you think? Did you approach correcting the charts differently than I did? Are you someone who has a color deficiency? Have you torn out your hair trying to read certain charts, and if so, do you have other suggestions that we, the chart makers, can do to improve? I would love for you to weigh in with your thoughts!

Congratulations, Power Users!

Congratulations to our newest Power Users! For the full gallery, and more information about the WSU Microsoft Office Power User Program, please visit: wichita.edu/poweruser

  • Johny Buchanan-Spachek

Johny Buchanan-Spachek