0% found this document useful (0 votes)
75 views

Dancing With Data

This document provides instructions for using Excel's DATE function to combine year, month, and day values into a single date value. It explains that the DATE function takes the year, month, and day as numbers, and explains the steps to enter the DATE function in a cell along with the year, month, and day values to generate a date. It also notes that the DATE function is useful when the date components are stored separately in cells rather than as a single date value.

Uploaded by

bill
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
75 views

Dancing With Data

This document provides instructions for using Excel's DATE function to combine year, month, and day values into a single date value. It explains that the DATE function takes the year, month, and day as numbers, and explains the steps to enter the DATE function in a cell along with the year, month, and day values to generate a date. It also notes that the DATE function is useful when the date components are stored separately in cells rather than as a single date value.

Uploaded by

bill
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 10

this goal, knowing that the average number of defective brake shoes is 25 per day?

Here are the steps to follow:

1. In a new worksheet, enter the average number of defects per day (25) in
a cell.

If desired, enter an adjacent label to identify the cell.

2. In the cell below, type =POISSON.DIST( to start the function entry.


3. Type the value 20.
4. Enter a comma (,).
5. Click the cell where you entered the average defects per day or enter its
cell address.

6. Enter a comma (,).


7. Type TRUE).
8. Press Enter to complete the formula.
9. If desired, enter a label in an adjacent cell to identify this as the probabil-
ity of 20 or fewer defects.

10. In the cell below, enter a formula that multiplies the number of working
days per month (22) by the result just calculated with the POISSON.DIST
function.

In your worksheet, this formula is =22*B3, entered in cell B4.

11. If desired, enter a label in an adjacent cell to identify this as the number
of days per month you can expect to have 20 or fewer defects.

The finished worksheet is shown in Figure 11-12. In this example, I have format-


ted cells B3:B4 with two decimal places. You can see that with an average of
25 defects per day, you can expect to earn a bonus 4 days a month.

FIGURE 11-12:
Using the
POISSON.DIST
function to
calculate a
cumulative
probability.

226 PART 3 Solving with Statistics


4
Dancing
with Data
IN THIS PART . . .

Master dates.

Calculate time.

Look up data and become logical.

Discover information about your data and your


computer system.

Test-drive the text functions.

Dig into data with the database functions.


IN THIS CHAPTER

»» Handling and formatting dates

»» Working with days, months, and


years

»» Getting the value of today

»» Determining the day of the week

»» Calculating the time between dates

Chapter  12
Dressing Up for Date
Functions

O
ften, when working with Excel, you need to manage dates. Perhaps you
have a list of dates when you visited a client and need to count how many
times you were there in September. On the other hand, maybe you are
tracking a project over a few months and want to know how many days are in
between the milestones.

Excel has a number of useful Date functions to make your work easier! This
­chapter explains how Excel handles dates, how to compare and subtract dates,
how to work with parts of a date (such as the month or year), and even how to
count the number of days between two dates. You can always reference the current
data from your computer’s clock and use it in a calculation; I show you how.

Understanding How Excel Handles Dates


Imagine that on January 1, 1900, you started counting by ones, each day adding
one more to the total. This is just how Excel thinks of dates. January 1, 1900, is one;
January 2, 1900, is two; and so on. We’ll always remember 25,404 as the day man
first walked on the moon, and 36,892 as the start of the new millennium!

CHAPTER 12 Dressing Up for Date Functions 229


The millennium actually started on January 1, 2001. The year 2000 is the last year
of the 20th century. Representing dates as a serial number  — specifically, the
number of days between January 1, 1900, and the date in question — may seem
odd, but there are very good reasons for it. Excel can handle dates from January 1,
1900, to December 31, 9999. Using the serial numbering system, that’s 1 through
2,958,465!

Because Excel represents dates in this way, it can work with dates in the same
manner as numbers. For example, you can subtract one date from another to find
out how many days are between them. Likewise, you can add 14 to today’s date to
get a date two weeks in the future. This trick is very useful, but people are used to
seeing dates represented in traditional formats, not as numbers. Fortunately,
Excel uses date serial numbers only behind the scenes, and what you see in your
workbook are dates in the standard date formats such as Jan 20, 2018 and 1/20/18.

In Excel for the Mac, the serial numbering system begins on January 1, 1904.

The way years are handled requires special mention. When a year is fully displayed
in 4 digits, such as 2018, there is no ambiguity. However, when a date is written in
a shorthand style, such as in 3/1/02, it isn’t clear what the year is. It could be 2002
or it could be 1902. Suppose that 3/1/02 is a shorthand entry for someone’s
­birthday. On March 1, 2005, he is either 3 years old or 103 years old. In those coun-
tries that write dates as dd/mm/yy, this would be January 3, 1902 or January 3,
2002.

Excel and the Windows operating system have a default way of interpreting short-
hand years. Windows has a setting in the Customize Regional Options dialog box
located in the Control Panel. This setting guides how Excel interprets years. If the
setting is 1930 through 2029, 3/1/18 indicates the year 2018, but 3/1/45 indicates
the year 1945, not 2045. Figure 12-1 shows this setting.

Here’s how to open and set it:

1. Use the Windows search feature to find and open Control Panel.

2. Select Clock and Region.

3. Select Region.

The Region dialog box opens.

4. Click the Formats tab.

5. Click the Additional Settings button.

The Customize Format dialog box opens.

6. Click the Date tab.

230 PART 4 Dancing with Data


7. In the Calendar section, select a 4-digit ending year (such as 2029) to
indicate the latest year that will be used when interpreting a 2-digit year.

8. Click OK to close each dialog box.

FIGURE 12-1:
Setting how years
are interpreted in
the Customize
Format
dialog box.

To ensure full accuracy when working with dates, always enter the full 4 digits for
the year.

Formatting Dates
When you work with dates, you probably need to format cells in your worksheet.
It’s great that Excel tells you that June 1, 2018, is serially represented as 43252, but
you probably don’t want that in a report. To format dates, you use the Format
Cells dialog box, shown in Figure 12-2.

To format the currently selected cells as dates, follow these steps:

1. If it’s not already displayed, click the Home tab at the top of the Excel
screen.

2. Click the small arrow at the bottom-right corner of the Number section.

The Format Cells dialog box appears, revealing the Number tab.

CHAPTER 12 Dressing Up for Date Functions 231


3. Select Date from the Category list.

4. Select an appropriate format from the Type list.

FIGURE 12-2:
Using the Format
Cells dialog box
to control how
dates are
displayed.

Now you can turn the useful but pesky serial dates into a user-friendly format.

When you enter a date in a cell using one of the standard date formats, Excel rec-
ognizes it as a date and automatically assigns a Date format to the cell. You may
want to use the Number tab in the Format Cells dialog box to assign a different
Date format.

Making a Date with DATE


You can use the DATE function to create a complete date from separate year,
month, and day information. The DATE function can be useful because dates don’t
always appear as, well, dates, in a worksheet. You may have a column of values
between 1 and 12 that represents the month and another column of values between
1 and 31 for the day of the month. A third column may hold years  — in either
2-digit shorthand or the full 4 digits.

The DATE function combines individual day, month, and year components into a
single usable date. This makes using and referencing dates in your worksheet
easy. Follow along to use the DATE function:

232 PART 4 Dancing with Data


1. Select the cell where you want the results displayed.

2. Type =DATE( to begin the function entry.

3. Click the cell that has the year.

4. Type a comma (,).

5. Click the cell that has the number (1–12) that represents the month.

6. Type a comma (,).

7. Click the cell that has the number (1–31) that represents the day of
the month.

8. Type a ) and press Enter.

Figure 12-3 displays a fourth column of dates that were created by using DATE and
the values from the first three columns. The fourth column of dates has been for-
matted so the dates are displayed in a standard format, not as a raw date serial
number.

FIGURE 12-3:
Using the DATE
function to
assemble a date
from separate
month, day, and
year values.

DATE provides some extra flexibility with the month number. Negative month
numbers are subtracted from the specified year. For example, the function
=DATE(2018, -5, 15) returns the date July 15, 2017, because July 2017 is 5 months
before the first month of 2018. Numbers greater than 12 work the same way.
=DATE(2018, 15, 1) returns March 1, 2019, because March 2019 is 15 months
after the first month of 2018.

Day numbers work the same way. Negative day numbers are subtracted from the
first of the specified month, and numbers that are greater than the last day of the
specified month wrap into later months. Thus, =DATE(2018, 2, 30) returns
March 2, 2018, because February does not have 30 days. Likewise, =DATE(2018,
2, 40) returns March 12, 2018.

CHAPTER 12 Dressing Up for Date Functions 233


Breaking a Date with DAY,
MONTH, and YEAR
That which can be put together can also be taken apart. In the preceding section,
I show you how to use the DATE function to create a date from separate year,
month, and day data. In this section, you find out how to do the reverse: Split a
date into individual year, month, and day components by using the DAY, MONTH,
and YEAR functions. In Figure 12-4, the dates in column A are split apart by day,
month, and year, respectively, in columns B, C, and D.

FIGURE 12-4:
Splitting apart a
date with the
DAY, MONTH,
and YEAR
functions.

Isolating the day


Isolating the day part of a date is useful in applications in which just the day, but
not the month or year, is relevant. Suppose that you own a store and want to
­figure out whether more customers come to shop in the first half or the second
half of the month. You’re interested in this trend over several months. So the task
may be to average the number of sales by the day of the month only.

The DAY function is useful for this because you can use it to return just the day for
a lengthy list of dates. Then you can examine results by the day only.

Here’s how you use the DAY function:

1. Position the pointer in the cell where you want the results displayed.

2. Type =DAY( to begin the function entry.

234 PART 4 Dancing with Data


3. Click the cell that has the date.

4. Type a ) and press Enter.

Excel returns a number between 1 and 31.

Figure 12-5 shows how the DAY function can be used to analyze customer activity.
Column A contains a full year’s sequential dates (most of which are not visible in
the figure). In column B, the day part of each date has been isolated. Column C
shows the customer traffic for each day.

FIGURE 12-5:
Using the DAY
function to
analyze customer
activity.

This is all the information you need to analyze whether there is a difference in the
amount of customer traffic between the first half and second half of the month.

Cells E4 and E10 show the average daily customer traffic for the first half and
­second half of the month, respectively. The value for the first half of the month
was obtained by adding all the customer values for day values in the range 1 to 15
and then dividing by the total number of days. The value for the second half of the
month was done the same way, using day values in the range 16 to 31.

The day parts of the dates, in column B, were key to these calculations:

»» In cell E4, the calculation is =SUMIF(B2:B366,"<16",C2:C366)/


COUNTIF(B2:B366"<16").

»» In cell E10, the calculation is =SUMIF(B2:B366,">15",C2:C366)/


COUNTIF(B2:B366,">15").

The SUMIF function is discussed in Chapter 8. The COUNTIF function is discussed


in Chapter 9.

CHAPTER 12 Dressing Up for Date Functions 235

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy