Sie sind auf Seite 1von 111

Caching Tutorial

for Web Authors and Webmasters

This is an informational document. Although technical in nature, it attempts to make the


concepts involved understandable and applicable in real-world situations. Because of this, some
aspects of the material are simplified or omitted, for the sake of clarity. If you are interested in
the minutia of the subject, please explore the References and Further Information at the end.

1. What’s a Web Cache? Why do people use them?


2. Kinds of Web Caches
1. Browser Caches
2. Proxy Caches
3. Aren’t Web Caches bad for me? Why should I help them?
4. How Web Caches Work
5. How (and how not) to Control Caches
1. HTML Meta Tags vs. HTTP Headers
2. Pragma HTTP Headers (and why they don’t work)
3. Controlling Freshness with the Expires HTTP Header
4. Cache-Control HTTP Headers
5. Validators and Validation
6. Tips for Building a Cache-Aware Site
7. Writing Cache-Aware Scripts
8. Frequently Asked Questions
9. Implementation Notes — Web Servers
10. Implementation Notes — Server-Side Scripting
11. References and Further Information
12. About This Document

What’s a Web Cache? Why do people use them?


A Web cache sits between one or more Web servers (also known as origin servers) and a client
or many clients, and watches requests come by, saving copies of the responses — like HTML
pages, images and files (collectively known as representations) — for itself. Then, if there is
another request for the same URL, it can use the response that it has, instead of asking the origin
server for it again.

There are two main reasons that Web caches are used:

 To reduce latency — Because the request is satisfied from the cache (which is closer to
the client) instead of the origin server, it takes less time for it to get the representation and
display it. This makes the Web seem more responsive.
 To reduce network traffic — Because representations are reused, it reduces the amount
of bandwidth used by a client. This saves money if the client is paying for traffic, and
keeps their bandwidth requirements lower and more manageable.
Kinds of Web Caches
Browser Caches

If you examine the preferences dialog of any modern Web browser (like Internet Explorer, Safari
or Mozilla), you’ll probably notice a “cache” setting. This lets you set aside a section of your
computer’s hard disk to store representations that you’ve seen, just for you. The browser cache
works according to fairly simple rules. It will check to make sure that the representations are
fresh, usually once a session (that is, the once in the current invocation of the browser).

This cache is especially useful when users hit the “back” button or click a link to see a page
they’ve just looked at. Also, if you use the same navigation images throughout your site, they’ll
be served from browsers’ caches almost instantaneously.

Proxy Caches

Web proxy caches work on the same principle, but a much larger scale. Proxies serve hundreds
or thousands of users in the same way; large corporations and ISPs often set them up on their
firewalls, or as standalone devices (also known as intermediaries).

Because proxy caches aren’t part of the client or the origin server, but instead are out on the
network, requests have to be routed to them somehow. One way to do this is to use your
browser’s proxy setting to manually tell it what proxy to use; another is using interception.
Interception proxies have Web requests redirected to them by the underlying network itself, so
that clients don’t need to be configured for them, or even know about them.

Proxy caches are a type of shared cache; rather than just having one person using them, they
usually have a large number of users, and because of this they are very good at reducing latency
and network traffic. That’s because popular representations are reused a number of times.

Gateway Caches

Also known as “reverse proxy caches” or “surrogate caches,” gateway caches are also
intermediaries, but instead of being deployed by network administrators to save bandwidth,
they’re typically deployed by Webmasters themselves, to make their sites more scalable, reliable
and better performing.

Requests can be routed to gateway caches by a number of methods, but typically some form of
load balancer is used to make one or more of them look like the origin server to clients.

Content delivery networks (CDNs) distribute gateway caches throughout the Internet (or a part of
it) and sell caching to interested Web sites. Speedera and Akamai are examples of CDNs.

This tutorial focuses mostly on browser and proxy caches, although some of the information is
suitable for those interested in gateway caches as well.
Aren’t Web Caches bad for me? Why should I help them?
Web caching is one of the most misunderstood technologies on the Internet. Webmasters in
particular fear losing control of their site, because a proxy cache can “hide” their users from
them, making it difficult to see who’s using the site.

Unfortunately for them, even if Web caches didn’t exist, there are too many variables on the
Internet to assure that they’ll be able to get an accurate picture of how users see their site. If this
is a big concern for you, this tutorial will teach you how to get the statistics you need without
making your site cache-unfriendly.

Another concern is that caches can serve content that is out of date, or stale. However, this
tutorial can show you how to configure your server to control how your content is cached.

CDNs are an interesting development, because unlike many proxy caches, their gateway caches
are aligned with the interests of the Web site being cached, so that these problems aren’t seen.
However, even when you use a CDN, you still have to consider that there will be proxy and
browser caches downstream.

On the other hand, if you plan your site well, caches can help your Web site load faster, and save
load on your server and Internet link. The difference can be dramatic; a site that is difficult to
cache may take several seconds to load, while one that takes advantage of caching can seem
instantaneous in comparison. Users will appreciate a fast-loading site, and will visit more often.

Think of it this way; many large Internet companies are spending millions of dollars setting up
farms of servers around the world to replicate their content, in order to make it as fast to access
as possible for their users. Caches do the same for you, and they’re even closer to the end user.
Best of all, you don’t have to pay for them.

The fact is that proxy and browser caches will be used whether you like it or not. If you don’t
configure your site to be cached correctly, it will be cached using whatever defaults the cache’s
administrator decides upon.

How Web Caches Work


All caches have a set of rules that they use to determine when to serve a representation from the
cache, if it’s available. Some of these rules are set in the protocols (HTTP 1.0 and 1.1), and some
are set by the administrator of the cache (either the user of the browser cache, or the proxy
administrator).

Generally speaking, these are the most common rules that are followed (don’t worry if you don’t
understand the details, it will be explained below):

1. If the response’s headers tell the cache not to keep it, it won’t.
2. If the request is authenticated or secure (i.e., HTTPS), it won’t be cached.
3. A cached representation is considered fresh (that is, able to be sent to a client without
checking with the origin server) if:
o It has an expiry time or other age-controlling header set, and is still within the
fresh period, or
o If the cache has seen the representation recently, and it was modified relatively
long ago.

Fresh representations are served directly from the cache, without checking with the origin
server.

4. If an representation is stale, the origin server will be asked to validate it, or tell the cache
whether the copy that it has is still good.
5. Under certain circumstances — for example, when it’s disconnected from a network — a
cache can serve stale responses without checking with the origin server.

If no validator (an ETag or Last-Modified header) is present on a response, and it doesn't have
any explicit freshness information, it will usually — but not always — be considered
uncacheable.

Together, freshness and validation are the most important ways that a cache works with content.
A fresh representation will be available instantly from the cache, while a validated representation
will avoid sending the entire representation over again if it hasn’t changed.

How (and how not) to Control Caches


There are several tools that Web designers and Webmasters can use to fine-tune how caches will
treat their sites. It may require getting your hands a little dirty with your server’s configuration,
but the results are worth it. For details on how to use these tools with your server, see the
Implementation sections below.

HTML Meta Tags and HTTP Headers

HTML authors can put tags in a document’s <HEAD> section that describe its attributes. These
meta tags are often used in the belief that they can mark a document as uncacheable, or expire it
at a certain time.

Meta tags are easy to use, but aren’t very effective. That’s because they’re only honored by a few
browser caches (which actually read the HTML), not proxy caches (which almost never read the
HTML in the document). While it may be tempting to put a Pragma: no-cache meta tag into a
Web page, it won’t necessarily cause it to be kept fresh.

If your site is hosted at an ISP or hosting farm and they don’t give you the ability to set arbitrary
HTTP headers (like Expires and Cache-Control), complain loudly; these are tools necessary
for doing your job.
On the other hand, true HTTP headers give you a lot of control over how both browser caches
and proxies handle your representations. They can’t be seen in the HTML, and are usually
automatically generated by the Web server. However, you can control them to some degree,
depending on the server you use. In the following sections, you’ll see what HTTP headers are
interesting, and how to apply them to your site.

HTTP headers are sent by the server before the HTML, and only seen by the browser and any
intermediate caches. Typical HTTP 1.1 response headers might look like this:

HTTP/1.1 200 OK
Date: Fri, 30 Oct 1998 13:19:41 GMT
Server: Apache/1.3.3 (Unix)
Cache-Control: max-age=3600, must-revalidate
Expires: Fri, 30 Oct 1998 14:19:41 GMT
Last-Modified: Mon, 29 Jun 1998 02:28:12 GMT
ETag: "3e86-410-3596fbbc"
Content-Length: 1040
Content-Type: text/html

The HTML would follow these headers, separated by a blank line. See the Implementation
sections for information about how to set HTTP headers.

Pragma HTTP Headers (and why they don’t work)

Many people believe that assigning a Pragma: no-cache HTTP header to a representation will
make it uncacheable. This is not necessarily true; the HTTP specification does not set any
guidelines for Pragma response headers; instead, Pragma request headers (the headers that a
browser sends to a server) are discussed. Although a few caches may honor this header, the
majority won’t, and it won’t have any effect. Use the headers below instead.

Controlling Freshness with the Expires HTTP Header

The Expires HTTP header is a basic means of controlling caches; it tells all caches how long the
associated representation is fresh for. After that time, caches will always check back with the
origin server to see if a document is changed. Expires headers are supported by practically
every cache.

Most Web servers allow you to set Expires response headers in a number of ways. Commonly,
they will allow setting an absolute time to expire, a time based on the last time that the client
retrieved the representation (last access time), or a time based on the last time the document
changed on your server (last modification time).

Expires headers are especially good for making static images (like navigation bars and buttons)
cacheable. Because they don’t change much, you can set extremely long expiry time on them,
making your site appear much more responsive to your users. They’re also useful for controlling
caching of a page that is regularly changed. For instance, if you update a news page once a day at
6am, you can set the representation to expire at that time, so caches will know when to get a
fresh copy, without users having to hit ‘reload’.
The only value valid in an Expires header is a HTTP date; anything else will most likely be
interpreted as ‘in the past’, so that the representation is uncacheable. Also, remember that the
time in a HTTP date is Greenwich Mean Time (GMT), not local time.

For example:

Expires: Fri, 30 Oct 1998 14:19:41 GMT

It’s important to make sure that your Web server’s clock is accurate if you use the Expires
header. One way to do this is using the Network Time Protocol (NTP); talk to your local system
administrator to find out more.

Although the Expires header is useful, it has some limitations. First, because there’s a date
involved, the clocks on the Web server and the cache must be synchronised; if they have a
different idea of the time, the intended results won’t be achieved, and caches might wrongly
consider stale content as fresh.

Another problem with Expires is that it’s easy to forget that you’ve set some content to expire at
a particular time. If you don’t update an Expires time before it passes, each and every request
will go back to your Web server, increasing load and latency.

Cache-Control HTTP Headers

HTTP 1.1 introduced a new class of headers, Cache-Control response headers, to give Web
publishers more control over their content, and to address the limitations of Expires.

Useful Cache-Control response headers include:

 max-age=[seconds] — specifies the maximum amount of time that an representation will


be considered fresh. Similar to Expires, this directive is relative to the time of the
request, rather than absolute. [seconds] is the number of seconds from the time of the
request you wish the representation to be fresh for.
 s-maxage=[seconds] — similar to max-age, except that it only applies to shared (e.g.,
proxy) caches.
 public — marks authenticated responses as cacheable; normally, if HTTP authentication
is required, responses are automatically private.
 private — allows caches that are specific to one user (e.g., in a browser) to store the
response; shared caches (e.g., in a proxy) may not.
 no-cache — forces caches to submit the request to the origin server for validation before
releasing a cached copy, every time. This is useful to assure that authentication is
respected (in combination with public), or to maintain rigid freshness, without sacrificing
all of the benefits of caching.
 no-store — instructs caches not to keep a copy of the representation under any
conditions.
 must-revalidate — tells caches that they must obey any freshness information you
give them about a representation. HTTP allows caches to serve stale representations
under special conditions; by specifying this header, you’re telling the cache that you want
it to strictly follow your rules.
 proxy-revalidate — similar to must-revalidate, except that it only applies to proxy
caches.

For example:

Cache-Control: max-age=3600, must-revalidate

If you plan to use the Cache-Control headers, you should have a look at the excellent
documentation in HTTP 1.1; see References and Further Information.

Validators and Validation

In How Web Caches Work, we said that validation is used by servers and caches to communicate
when an representation has changed. By using it, caches avoid having to download the entire
representation when they already have a copy locally, but they’re not sure if it’s still fresh.

Validators are very important; if one isn’t present, and there isn’t any freshness information
(Expires or Cache-Control) available, caches will not store a representation at all.

The most common validator is the time that the document last changed, as communicated in
Last-Modified header. When a cache has an representation stored that includes a Last-
Modified header, it can use it to ask the server if the representation has changed since the last
time it was seen, with an If-Modified-Since request.

HTTP 1.1 introduced a new kind of validator called the ETag. ETags are unique identifiers that
are generated by the server and changed every time the representation does. Because the server
controls how the ETag is generated, caches can be surer that if the ETag matches when they
make a If-None-Match request, the representation really is the same.

Almost all caches use Last-Modified times in determining if an representation is fresh; ETag
validation is also becoming prevalent.

Most modern Web servers will generate both ETag and Last-Modified headers to use as
validators for static content (i.e., files) automatically; you won’t have to do anything. However,
they don’t know enough about dynamic content (like CGI, ASP or database sites) to generate
them; see Writing Cache-Aware Scripts.

Tips for Building a Cache-Aware Site


Besides using freshness information and validation, there are a number of other things you can
do to make your site more cache-friendly.
 Use URLs consistently — this is the golden rule of caching. If you serve the same
content on different pages, to different users, or from different sites, it should use the
same URL. This is the easiest and most effective way to make your site cache-friendly.
For example, if you use “/index.html” in your HTML as a reference once, always use it
that way.
 Use a common library of images and other elements and refer back to them from
different places.
 Make caches store images and pages that don’t change often by using a Cache-
Control: max-age header with a large value.
 Make caches recognise regularly updated pages by specifying an appropriate max-age
or expiration time.
 If a resource (especially a downloadable file) changes, change its name. That way,
you can make it expire far in the future, and still guarantee that the correct version is
served; the page that links to it is the only one that will need a short expiry time.
 Don’t change files unnecessarily. If you do, everything will have a falsely young Last-
Modified date. For instance, when updating your site, don’t copy over the entire site; just
move the files that you’ve changed.
 Use cookies only where necessary — cookies are difficult to cache, and aren’t needed in
most situations. If you must use a cookie, limit its use to dynamic pages.
 Minimize use of SSL — because encrypted pages are not stored by shared caches, use
them only when you have to, and use images on SSL pages sparingly.
 Check your pages with REDbot — it can help you apply many of the concepts in this
tutorial.

Writing Cache-Aware Scripts


By default, most scripts won’t return a validator (a Last-Modified or ETag response header) or
freshness information (Expires or Cache-Control). While some scripts really are dynamic
(meaning that they return a different response for every request), many (like search engines and
database-driven sites) can benefit from being cache-friendly.

Generally speaking, if a script produces output that is reproducible with the same request at a
later time (whether it be minutes or days later), it should be cacheable. If the content of the script
changes only depending on what’s in the URL, it is cacheble; if the output depends on a cookie,
authentication information or other external criteria, it probably isn’t.

 The best way to make a script cache-friendly (as well as perform better) is to dump its
content to a plain file whenever it changes. The Web server can then treat it like any other
Web page, generating and using validators, which makes your life easier. Remember to
only write files that have changed, so the Last-Modified times are preserved.
 Another way to make a script cacheable in a limited fashion is to set an age-related
header for as far in the future as practical. Although this can be done with Expires, it’s
probably easiest to do so with Cache-Control: max-age, which will make the request
fresh for an amount of time after the request.
 If you can’t do that, you’ll need to make the script generate a validator, and then respond
to If-Modified-Since and/or If-None-Match requests. This can be done by parsing the
HTTP headers, and then responding with 304 Not Modified when appropriate.
Unfortunately, this is not a trival task.

Some other tips;

 Don’t use POST unless it’s appropriate. Responses to the POST method aren’t kept by
most caches; if you send information in the path or query (via GET), caches can store that
information for the future.
 Don’t embed user-specific information in the URL unless the content generated is
completely unique to that user.
 Don’t count on all requests from a user coming from the same host, because caches
often work together.
 Generate Content-Length response headers. It’s easy to do, and it will allow the
response of your script to be used in a persistent connection. This allows clients to
request multiple representations on one TCP/IP connection, instead of setting up a
connection for every request. It makes your site seem much faster.

See the Implementation Notes for more specific information.

Frequently Asked Questions


What are the most important things to make cacheable?

A good strategy is to identify the most popular, largest representations (especially images) and
work with them first.

How can I make my pages as fast as possible with caches?

The most cacheable representation is one with a long freshness time set. Validation does help
reduce the time that it takes to see a representation, but the cache still has to contact the origin
server to see if it’s fresh. If the cache already knows it’s fresh, it will be served directly.

I understand that caching is good, but I need to keep statistics on how many
people visit my page!

If you must know every time a page is accessed, select ONE small item on a page (or the page
itself), and make it uncacheable, by giving it a suitable headers. For example, you could refer to
a 1x1 transparent uncacheable image from each page. The Referer header will contain
information about what page called it.

Be aware that even this will not give truly accurate statistics about your users, and is unfriendly
to the Internet and your users; it generates unnecessary traffic, and forces people to wait for that
uncached item to be downloaded. For more information about this, see On Interpreting Access
Statistics in the references.

How can I see a representation’s HTTP headers?

Many Web browsers let you see the Expires and Last-Modified headers are in a “page info” or
similar interface. If available, this will give you a menu of the page and any representations (like
images) associated with it, along with their details.

To see the full headers of a representation, you can manually connect to the Web server using a
Telnet client.

To do so, you may need to type the port (be default, 80) into a separate field, or you may need to
connect to www.example.com:80 or www.example.com 80 (note the space). Consult your Telnet
client’s documentation.

Once you’ve opened a connection to the site, type a request for the representation. For instance,
if you want to see the headers for http://www.example.com/foo.html, connect to
www.example.com, port 80, and type:

GET /foo.html HTTP/1.1 [return]


Host: www.example.com [return][return]

Press the Return key every time you see [return]; make sure to press it twice at the end. This
will print the headers, and then the full representation. To see the headers only, substitute HEAD
for GET.

My pages are password-protected; how do proxy caches deal with them?

By default, pages protected with HTTP authentication are considered private; they will not be
kept by shared caches. However, you can make authenticated pages public with a Cache-Control:
public header; HTTP 1.1-compliant caches will then allow them to be cached.

If you’d like such pages to be cacheable, but still authenticated for every user, combine the
Cache-Control: public and no-cache headers. This tells the cache that it must submit the
new client’s authentication information to the origin server before releasing the representation
from the cache. This would look like:

Cache-Control: public, no-cache

Whether or not this is done, it’s best to minimize use of authentication; for example, if your
images are not sensitive, put them in a separate directory and configure your server not to force
authentication for it. That way, those images will be naturally cacheable.

Should I worry about security if people access my site through a cache?


SSL pages are not cached (or decrypted) by proxy caches, so you don’t have to worry about that.
However, because caches store non-SSL requests and URLs fetched through them, you should
be conscious about unsecured sites; an unscrupulous administrator could conceivably gather
information about their users, especially in the URL.

In fact, any administrator on the network between your server and your clients could gather this
type of information. One particular problem is when CGI scripts put usernames and passwords in
the URL itself; this makes it trivial for others to find and user their login.

If you’re aware of the issues surrounding Web security in general, you shouldn’t have any
surprises from proxy caches.

I’m looking for an integrated Web publishing solution. Which ones are cache-
aware?

It varies. Generally speaking, the more complex a solution is, the more difficult it is to cache.
The worst are ones which dynamically generate all content and don’t provide validators; they
may not be cacheable at all. Speak with your vendor’s technical staff for more information, and
see the Implementation notes below.

My images expire a month from now, but I need to change them in the caches
now!

The Expires header can’t be circumvented; unless the cache (either browser or proxy) runs out of
room and has to delete the representations, the cached copy will be used until then.

The most effective solution is to change any links to them; that way, completely new
representations will be loaded fresh from the origin server. Remember that the page that refers to
an representation will be cached as well. Because of this, it’s best to make static images and
similar representations very cacheable, while keeping the HTML pages that refer to them on a
tight leash.

If you want to reload an representation from a specific cache, you can either force a reload (in
Firefox, holding down shift while pressing ‘reload’ will do this by issuing a Pragma: no-cache
request header) while using the cache. Or, you can have the cache administrator delete the
representation through their interface.

I run a Web Hosting service. How can I let my users publish cache-friendly
pages?

If you’re using Apache, consider allowing them to use .htaccess files and providing appropriate
documentation.

Otherwise, you can establish predetermined areas for various caching attributes in each virtual
server. For instance, you could specify a directory /cache-1m that will be cached for one month
after access, and a /no-cache area that will be served with headers instructing caches not to store
representations from it.

Whatever you are able to do, it is best to work with your largest customers first on caching. Most
of the savings (in bandwidth and in load on your servers) will be realized from high-volume
sites.

I’ve marked my pages as cacheable, but my browser keeps requesting them on


every request. How do I force the cache to keep representations of them?

Caches aren’t required to keep a representation and reuse it; they’re only required to not keep or
use them under some conditions. All caches make decisions about which representations to keep
based upon their size, type (e.g., image vs. html), or by how much space they have left to keep
local copies. Yours may not be considered worth keeping around, compared to more popular or
larger representations.

Some caches do allow their administrators to prioritize what kinds of representations are kept,
and some allow representations to be “pinned” in cache, so that they’re always available.

Implementation Notes — Web Servers


Generally speaking, it’s best to use the latest version of whatever Web server you’ve chosen to
deploy. Not only will they likely contain more cache-friendly features, new versions also usually
have important security and performance improvements.

Apache HTTP Server

Apache uses optional modules to include headers, including both Expires and Cache-Control.
Both modules are available in the 1.2 or greater distribution.

The modules need to be built into Apache; although they are included in the distribution, they are
not turned on by default. To find out if the modules are enabled in your server, find the httpd
binary and run httpd -l; this should print a list of the available modules (note that this only lists
compiled-in modules; on later versions of Apache, use httpd -M to include dynamically loaded
modules as well). The modules we’re looking for are mod_expires and mod_headers.

 If they aren’t available, and you have administrative access, you can recompile Apache to
include them. This can be done either by uncommenting the appropriate lines in the
Configuration file, or using the -enable-module=expires and -enable-
module=headers arguments to configure (1.3 or greater). Consult the INSTALL file
found with the Apache distribution.

Once you have an Apache with the appropriate modules, you can use mod_expires to specify
when representations should expire, either in .htaccess files or in the server’s access.conf file.
You can specify expiry from either access or modification time, and apply it to a file type or as a
default. See the module documentation for more information, and speak with your local Apache
guru if you have trouble.

To apply Cache-Control headers, you’ll need to use the mod_headers module, which allows
you to specify arbitrary HTTP headers for a resource. See the mod_headers documentation.

Here’s an example .htaccess file that demonstrates the use of some headers.

 .htaccess files allow web publishers to use commands normally only found in
configuration files. They affect the content of the directory they’re in and their
subdirectories. Talk to your server administrator to find out if they’re enabled.

### activate mod_expires


ExpiresActive On
### Expire .gif's 1 month from when they're accessed
ExpiresByType image/gif A2592000
### Expire everything else 1 day from when it's last modified
### (this uses the Alternative syntax)
ExpiresDefault "modification plus 1 day"
### Apply a Cache-Control header to index.html
<Files index.html>
Header append Cache-Control "public, must-revalidate"
</Files>

 Note that mod_expires automatically calculates and inserts a Cache-Control:max-age


header as appropriate.

Apache 2’s configuration is very similar to that of 1.3; see the 2.2 mod_expires and mod_headers
documentation for more information.

Microsoft IIS

Microsoft’s Internet Information Server makes it very easy to set headers in a somewhat flexible
way. Note that this is only possible in version 4 of the server, which will run only on NT Server.

To specify headers for an area of a site, select it in the Administration Tools interface, and
bring up its properties. After selecting the HTTP Headers tab, you should see two interesting
areas; Enable Content Expiration and Custom HTTP headers. The first should be self-
explanatory, and the second can be used to apply Cache-Control headers.

See the ASP section below for information about setting headers in Active Server Pages. It is
also possible to set headers from ISAPI modules; refer to MSDN for details.

Netscape/iPlanet Enterprise Server

As of version 3.6, Enterprise Server does not provide any obvious way to set Expires headers.
However, it has supported HTTP 1.1 features since version 3.0. This means that HTTP 1.1
caches (proxy and browser) will be able to take advantage of Cache-Control settings you make.
To use Cache-Control headers, choose Content Management | Cache Control Directives
in the administration server. Then, using the Resource Picker, choose the directory where you
want to set the headers. After setting the headers, click ‘OK’. For more information, see the NES
manual.

Implementation Notes — Server-Side Scripting


One thing to keep in mind is that it may be easier to set HTTP headers with your Web server
rather than in the scripting language. Try both.

Because the emphasis in server-side scripting is on dynamic content, it doesn’t make for very
cacheable pages, even when the content could be cached. If your content changes often, but not
on every page hit, consider setting a Cache-Control: max-age header; most users access pages
again in a relatively short period of time. For instance, when users hit the ‘back’ button, if there
isn’t any validator or freshness information available, they’ll have to wait until the page is re-
downloaded from the server to see it.

CGI

CGI scripts are one of the most popular ways to generate content. You can easily append HTTP
response headers by adding them before you send the body; Most CGI implementations already
require you to do this for the Content-Type header. For instance, in Perl;

#!/usr/bin/perl
print "Content-type: text/html\n";
print "Expires: Thu, 29 Oct 1998 17:04:19 GMT\n";
print "\n";
### the content body follows...

Since it’s all text, you can easily generate Expires and other date-related headers with in-built
functions. It’s even easier if you use Cache-Control: max-age;

print "Cache-Control: max-age=600\n";

This will make the script cacheable for 10 minutes after the request, so that if the user hits the
‘back’ button, they won’t be resubmitting the request.

The CGI specification also makes request headers that the client sends available in the
environment of the script; each header has ‘HTTP_’ prepended to its name. So, if a client makes
an If-Modified-Since request, it will show up as HTTP_IF_MODIFIED_SINCE.

See also the cgi_buffer library, which automatically handles ETag generation and validation,
Content-Length generation and gzip content-coding for Perl and Python CGI scripts with a
one-line include. The Python version can also be used to wrap arbitrary CGI scripts with.

Server Side Includes


SSI (often used with the extension .shtml) is one of the first ways that Web publishers were able
to get dynamic content into pages. By using special tags in the pages, a limited form of in-HTML
scripting was available.

Most implementations of SSI do not set validators, and as such are not cacheable. However,
Apache’s implementation does allow users to specify which SSI files can be cached, by setting
the group execute permissions on the appropriate files, combined with the XbitHack full
directive. For more information, see the mod_include documentation.

PHP

PHP is a server-side scripting language that, when built into the server, can be used to embed
scripts inside a page’s HTML, much like SSI, but with a far larger number of options. PHP can
be used as a CGI script on any Web server (Unix or Windows), or as an Apache module.

By default, representations processed by PHP are not assigned validators, and are therefore
uncacheable. However, developers can set HTTP headers by using the Header() function.

For example, this will create a Cache-Control header, as well as an Expires header three days in
the future:

<?php
Header("Cache-Control: must-revalidate");

$offset = 60 * 60 * 24 * 3;
$ExpStr = "Expires: " . gmdate("D, d M Y H:i:s", time() + $offset) . " GMT";
Header($ExpStr);
?>

Remember that the Header() function MUST come before any other output.

As you can see, you’ll have to create the HTTP date for an Expires header by hand; PHP
doesn’t provide a function to do it for you (although recent versions have made it easier; see the
PHP's date documentation). Of course, it’s easy to set a Cache-Control: max-age header,
which is just as good for most situations.

For more information, see the manual entry for header.

See also the cgi_buffer library, which automatically handles ETag generation and validation,
Content-Length generation and gzip content-coding for PHP scripts with a one-line include.

Cold Fusion

Cold Fusion, by Macromedia is a commercial server-side scripting engine, with support for
several Web servers on Windows, Linux and several flavors of Unix.
Cold Fusion makes setting arbitrary HTTP headers relatively easy, with the CFHEADER tag.
Unfortunately, their example for setting an Expires header, as below, is a bit misleading.

<CFHEADER NAME="Expires" VALUE="#Now()#">

It doesn’t work like you might think, because the time (in this case, when the request is made)
doesn’t get converted to a HTTP-valid date; instead, it just gets printed as a representation of
Cold Fusion’s Date/Time object. Most clients will either ignore such a value, or convert it to a
default, like January 1, 1970.

However, Cold Fusion does provide a date formatting function that will do the job;
GetHttpTimeString. In combination with DateAdd, it’s easy to set Expires dates; here, we set a
header to declare that representations of the page expire in one month;

<cfheader name="Expires"
value="#GetHttpTimeString(DateAdd('m', 1, Now()))#">

You can also use the CFHEADER tag to set Cache-Control: max-age and other headers.

Remember that Web server headers are passed through in some deployments of Cold Fusion
(such as CGI); check yours to determine whether you can use this to your advantage, by setting
headers on the server instead of in Cold Fusion.

ASP and ASP.NET

When setting HTTP headers from ASPs, make sure you either place the Response method calls
before any HTML generation, or use Response.Buffer to buffer the output. Also, note that
some versions of IIS set a Cache-Control: private header on ASPs by default, and must be
declared public to be cacheable by shared caches.

Active Server Pages, built into IIS and also available for other Web servers, also allows you to
set HTTP headers. For instance, to set an expiry time, you can use the properties of the Response
object;

<% Response.Expires=1440 %>

specifying the number of minutes from the request to expire the representation. Cache-Control
headers can be added like this:

<% Response.CacheControl="public" %>

In ASP.NET, Response.Expires is deprecated; the proper way to set cache-related headers is


with Response.Cache;

Response.Cache.SetExpires ( DateTime.Now.AddMinutes ( 60 ) ) ;
Response.Cache.SetCacheability ( HttpCacheability.Public ) ;
See the MSDN documentation for more information.

References and Further Information


HTTP 1.1 Specification

The HTTP 1.1 spec has many extensions for making pages cacheable, and is the authoritative
guide to implementing the protocol. See sections 13, 14.9, 14.21, and 14.25.

Web-Caching.com

An excellent introduction to caching concepts, with links to other online resources.

On Interpreting Access Statistics

Jeff Goldberg’s informative rant on why you shouldn’t rely on access statistics and hit counters.

REDbot

Examines HTTP resources to determine how they will interact with Web caches, and generally
how well they use the protocol.

cgi_buffer Library

One-line include in Perl CGI, Python CGI and PHP scripts automatically handles ETag
generation and validation, Content-Length generation and gzip Content-Encoding — correctly.
The Python version can also be used as a wrapper around arbitrary CGI scripts.

About This Document


This document is Copyright © 1998-2010 Mark Nottingham <mnot@pobox.com>. This work is
licensed under a Creative Commons Attribution-Noncommercial-No Derivative Works 3.0
Unported License.

All trademarks within are property of their respective holders.

Although the author believes the contents to be accurate at the time of publication, no liability is
assumed for them, their application or any consequences thereof. If any misrepresentations,
errors or other need for clarification is found, please contact the author immediately.

The latest revision of this document can always be obtained from


http://www.mnot.net/cache_docs/

Translations are available in: Belarusian, Chinese, Czech, German, and French.
June 29, 2010

about blog photos home

Setting up Your Excel Environment

Before you begin creating spreadsheets in Excel, you may want


to set up your Excel environment and become familiar with a few key tasks and features such
as how to minimize and maximize the Ribbon, configure the Quick Access toolbar, switch page
views, and access your Excel options.

Exploring and Setting Up Your Excel Environment

Watch the video! (5:19 min) - Tips for watching our videos.

Exploring the Excel Environment

The tabbed Ribbon menu system is how you navigate through Excel and access the various
Excel commands. If you have used previous versions of Excel, the Ribbon system replaces the
traditional menus. Above the Ribbon in the upper-left corner is the Microsoft Office Button.
From here, you can access important options such as New, Save, Save As, and Print. By default
the Quick Access Toolbar is pinned next to the Microsoft Office Button, and includes
commands such as Undo and Redo.

At the bottom, left area of the spreadsheet, you will find worksheet tabs. By default, three
worksheet tabs appear each time you create a new workbook. On the bottom, right area of the
spreadsheet you will find page view commands, the zoom tool, and the horizontal scrolling bar.
To Zoom In and Out:

 Locate the zoom bar in the bottom, right corner.


 Left-click the slider and drag it to the left to zoom in and to the right to zoom out.

To Scroll Horizontally in a Worksheet:

 Locate the horizontal scroll bar in the bottom, right corner.


 Left-click the bar and move it from left to right.
To Change Page Views:

 Locate the Page View options in the bottom, right corner. The Page View options are Normal,
Page Layout, and Page Break.
 Left-click an option to select it.

The default is Normal View.

To Add Commands to the Quick Access Toolbar:

 Click the arrow to the right of the Quick Access toolbar.


 Select the command you wish to add from the drop-down list. It will appear in the Quick Access
toolbar.
OR

 Select More Commands from the menu and a dialog box appears.
 Select the command you wish to add.
 Click the Add button.
 Click OK.

The Save, Undo, and Redo commands appear by default in the Quick Access toolbar. You may
wish to add other commands to make using specific Excel features more convenient for you.

To Minimize and Maximize the Ribbon:

 Click the drop-down arrow next to the Quick Access toolbar.


 Select Minimize Ribbon from the list. The Ribbon disappears.
 To maximize the ribbon, click the arrow again and select Minimize the Ribbon to toggle the
feature off.
You can also minimize and maximize the Ribbon by right-clicking anywhere in the main menu
and selecting Minimize the Ribbon in the menu that appears.

The new, tabbed Ribbon system replaces traditional menus in Excel 2007. It is designed to be
responsive to your current task and easy to use; however, you can choose to minimize the
Ribbon if you would prefer to use different menus or keyboard shortcuts.

The Microsoft Office Button

The Microsoft Office Button appears at the top of the Excel window. When you left-click the
button, a menu appears. From this menu you can create a new spreadsheet, open existing files,
save files in a variety of ways, and print. You can also add security features, send, publish, and
close files.
To Change the Default Excel Options:

 Click the Excel Options button. A dialog box will appear.


 Select a category on the left to access different Excel options.

 Modify any of the default settings.


 Click OK.

As you learn more about Excel and become proficient at using it, you may want to modify some
of the settings. As a beginning user, it is usually best to leave the default settings.

Challenge!

 Open Excel.
 Practice using the Zoom tool.
 Minimize and maximize the Ribbon.
 Click the Microsoft Office Button and review the menu options.
 Add two commands to the Quick Access toolbar.
 Continue to explore the Excel environment.
Starting a Workbook

You will need to know how to insert text and numbers into
Excel workbooks to be able to use it to calculate, analyze, and organize data. In this lesson, you
will learn how to create a new workbook, insert and delete text, navigate a worksheet, and save
an Excel workbook.

Your First Workbook

Watch the video! (5:13 min) - Tips for watching our videos.

To Create a New, Blank Workbook:

 Left-click the Microsoft Office Button.


 Select New. The New Workbook dialog box opens and Blank Workbook is highlighted by default.
 Click Create. A new, blank workbook appears in the window.
When you first open Excel, the software opens to a new, blank workbook.

To Insert Text:

 Left-click a cell to select it. Each rectangle in the worksheet is called a cell. As you select a cell,
the cell address appears in the Name Box.
 Enter text into the cell using your keyboard. The text appears in the cell and in the formula bar.

Each cell has a name, or a cell address based on the column and row it is in. For example, this
cell is C3 since it is where column C and row 3 intersect.

To Edit or Delete Text:

 Select the cell.


 Press the Backspace key on your keyboard to delete text and make a correction.
 Press the Delete key to delete the entire contents of a cell.

You can also make changes to and delete text from the formula bar. Just select the cell and
place your insertion point in the formula bar.
To Move Through a Worksheet Using the Keyboard:

 Press the Tab key to move to the right of the selected cell.
 Press the Shift key and then the Tab key to move to the left of the selected cell.
 Use the Page Up and Page Down keys to navigate the worksheet.
 Use the arrow keys.

To Save the Workbook:

 Left-click the Microsoft Office Button.


 Select Save or Save As.
o Save As allows you to name the file and choose a location to save the spreadsheet.
Choose Save As if you'd like to save the file for the first time or if you'd like to save the
file as a different name.
o Select Save if the file has already been named.

You can save a workbook in many ways, but the two most common are as an Excel Workbook,
which saves it with a 2007 file extension, and as an Excel 97-2003 Workbook, which saves the
file in a compatible format so people who have earlier versions of Excel can open the file.

Modifying Columns, Rows, and Cells


When you open a new, blank workbook, the cells, columns, and
rows are set to a default size. You do have the ability to change the size of each, and to insert
new columns, rows, and cells, as needed. In this lesson, you will learn various methods to
modify the column width and row height, in addition to how to insert new columns, rows, and
cells.

Columns, Rows, and Cells

Watch the video! (6:19 min) - Tips for watching our videos.

Download the example to work along with the video.

To Modify Column Width:

 Position the cursor over the column line in the column heading and a double arrow will appear.

 Left-click the mouse and drag the cursor to the right to increase the column width or to the left
to decrease the column width.
 Release the mouse button.
OR

 Left-click the column heading of a column you'd like to modify. The entire column will appear
highlighted.

 Click the Format command in the Cells group on the Home tab. A menu will appear.
 Select Column Width to enter a specific column measurement.
 Select AutoFit Column Width to adjust the column so all the text will fit.

To Modify the Row Height:

 Position the cursor over the row line you want to modify and a double arrow will appear.
 Left-click the mouse and drag the cursor upward to decrease the row height or downward to
increase the row height.
 Release the mouse button.

OR

 Click the Format command in the Cells group on the Home tab. A menu will appear.

 Select Row Height to enter a specific row measurement.


 Select AutoFit Row Height to adjust the row so all the text will fit.

To Insert Rows:

 Select the row below where you want the new row to appear.
 Click the Insert command in the Cells group on the Home tab. The row will appear.
The new row always appears above the selected row.

Make sure that you select the entire row below where you want the new row to appear and not
just the cell. If you select just the cell and then click Insert, only a new cell will appear.

To Insert Columns:

 Select the column to the right of where you want the column to appear.
 Click the Insert command in the Cells group on the Home tab. The column will appear.

The new column always appears to the left of the selected column. For example, if you want to
insert a column between September and October, select the October column and click the Insert
command.
Make sure that you select the entire column to the right of where you want the new column to
appear and not just the cell. If you select just the cell and then click Insert, only a new cell will
appear.

To Delete Rows and Columns:

 Select the row or column you’d like to delete.


 Click the Delete command in the Cells group on the Home tab.

Challenge!

Use the Budget or any Excel workbook you choose to complete this challenge.

 Open a workbook.
 Insert a column.
 Insert a row.
 Delete a column.
 Change the width of a column using AutoAdjust.
 Change the height of a row.
 Close and save the file.

Formatting Text
Once you have entered information into a spreadsheet, you will
need to be able to format it. In this lesson, you will learn how to use the bold, italic, and
underline commands; modify the font style, size, and color; and apply borders and fill colors.

Formatting Cells

Watch the video! (8:32 min) - Tips for watching our videos.

Download the example to work along with the video.

To Format Text in Bold or Italics:

 Left-click a cell to select it or drag your cursor over the text in the formula bar to select it.
 Click the Bold or Italics command.
You can select entire columns and rows, or specific cells. To select the entire column, just left-
click the column heading and the entire column will appear as selected. To select specific cells,
just left-click a cell and drag your mouse to select the other cells. Then, release the mouse button.

To Format Text as Underlined:

 Select the cell or cells you want to format.


 Click the drop-down arrow next to the Underline command.
 Select the Single Underline or Double Underline option.

To Change the Font Style

 Select the cell or cells you want to format.


 Left-click the drop-down arrow next to the Font Style box on the Home tab.
 Select a font style from the list.
As you move over the font list, the Live Preview feature previews the font for you in the
spreadsheet.

To Change the Font Size:

 Select the cell or cells you want to format.


 Left-click the drop-down arrow next to the Font Size box on the Home tab.
 Select a font size from the list.

To Change the Text Color:

 Select the cell or cells you want to format.


 Left-click the drop-down arrow next to the Text Color command. A color palette will appear.
 Select a color from the palette.
OR

 Select More Colors. A dialog box will appear.


 Select a color.
 Click OK.

To Add a Border:

 Select the cell or cells you want to format.


 Click the drop-down arrow next to the Borders command on the Home tab. A menu will appear
with border options.

 Left-click an option from the list to select it.

You can change the line style and color of the border.

To add a Fill Color:

 Select the cell or cells you want to format.


 Click the Fill command. A color palette will appear.
 Select a color.
OR

 Select More Colors. A dialog box will appear.


 Select a color.
 Click OK.

You can use the fill color feature to format columns and rows, and format a worksheet so that it
is easier to read.

To Format Numbers and Dates:

 Select the cell or cells you want to format.


 Left-click the drop-down arrow next to the Number Format box.
 Select one of the options for formatting numbers.

By default, the numbers appear in the General category, which means there is no special
formatting.
In the Number group, you have some other options. For example, you can change the U.S. dollar
sign to another currency format, numbers to percents, add commas, and change the decimal
location.

Challenge!

Use the Budget or any Excel workbook you choose to complete this challenge.

 Select a cell and format the text or numbers in it so that they appear bolded.
 Select two or more cells and format the text or numbers so that they appear in italics.
 Change fill color of two or more cells.
 Add a border to a row.

Creating Simple Formulas

Excel can be used to calculate and analyze numerical


information; however, you will need to know how to write formulas to maximize Excel's
capabilities. A formula is an equation that performs a calculation using values in the worksheet.
In this lesson you will learn how to create simple formulas using mathematical operators such
as the addition, subtraction, multiplication, and division signs.

Simple Formulas

Watch the video! (10:47 min) - Tips for watching our videos.

Download the example to work along with the video.

To Create a Simple Formula that Adds Two Numbers:

 Click the cell where the formula will be defined (C5, for example).
 Type the equal sign (=) to let Excel know a formula is being defined.
 Type the first number to be added (e.g., 1500)
 Type the addition sign (+) to let Excel know that an add operation is to be performed.
 Type the second number to be added (e.g., 200)
 Press Enter or click the Enter button on the Formula bar to complete the formula.

To Create a Simple Formula that Adds the Contents of Two Cells:

 Click the cell where the answer will appear (C5, for example).
 Type the equal sign (=) to let Excel know a formula is being defined.
 Type the cell number that contains the first number to be added (C3, for example).
 Type the addition sign (+) to let Excel know that an add operation is to be performed.
 Type the cell address that contains the second number to be added (C4, for example).
 Press Enter or click the Enter button on the Formula bar to complete the formula.

To Create a Simple Formula using the Point and Click Method:

 Click the cell where the answer will appear (C30, for example).
 Type the equal sign (=) to let Excel know a formula is being defined.
 Click on the first cell to be included in the formula (C5, for example).
 Type the subtraction sign (-) to let Excel know that a subtraction operation is to be performed.
 Click on the next cell in the formula (C29, for example).
 Press Enter or click the Enter button on the Formula bar to complete the formula.

To Create a Simple Formula that Multiplies the Contents of Two Cells:

 Select the cell where the answer will appear (E32, for example).
 Type the equal sign (=) to let Excel know a formula is being defined.
 Click on the first cell to be included in the formula (C9, for example) or type a number.
 Type the multiplication symbol (*) by pressing the Shift key and then the number 8 key. The
operator displays in the cell and Formula bar.
 Click on the next cell in the formula or type a number (12, for example).
 Press Enter or click the Enter button on the Formula bar to complete the formula.

.
To Create a Simple Formula that Divides One Cell by Another:

 Click the cell where the answer will appear.


 Type the equal sign (=) to let Excel know a formula is being defined.
 Click on the first cell to be included in the formula.
 Type a division symbol. The operator displays in the cell and Formula bar.
 Click on the next cell in the formula.
 Enter or click the Enter button on the Formula bar to complete the formula.
 Using Cell References

 As you can see, there are many ways to create a simple formula in Excel. Most likely you
will choose one of the methods that enters the cell address into the formula, rather than an
actual number. The cell address is basically the name of the cell and can be found in the
Name Box.



 The following example uses actual numbers in the formula in C5.



 When a cell address is used as part of a formula, this is called a cell reference. It is called
a cell reference because instead of entering specific numbers into a formula, the cell
address refers to a specific cell. The following example uses cell references in the
formula in C30.

Challenge!

Use the Budget or any Excel workbook you choose to complete this challenge.

 Write a simple addition formula.


 Write a simple subtraction formula using the point and click method.
 Write a simple multiplication formula using cell references.
 Write a simple division formula.

Working with Cells


It is important to know how to move information from one cell
to another in Excel. Learning the various ways will save you time and make working with Excel
easier. Certain methods are more appropriate depending on how much information you need to
move and where it will reside on the spreadsheet. In this lesson you will learn how to cut, copy,
and paste, as well as drag and drop information.

Working with Cells

Watch the video! (6:10 min) - Tips for watching our videos.

Download the example to work along with the video.

To Copy and Paste Cell Contents:

 Select the cell or cells you wish to copy.


 Click the Copy command in the Clipboard group on the Home tab. The border of the selected
cells will change appearance.
 Select the cell or cells where you want to paste the information.
 Click the Paste command. The copied information will now appear in the new cells.

To select more than one adjoining cell, left-click one of the cells, drag the cursor until all the
cells are selected, and release the mouse button.
The copied cell will stay selected until you perform your next task, or you can double-click the
cell to deselect it.

To Cut and Paste Cell Contents:

 Select the cell or cells you wish to copy.


 Click the Cut command in the Clipboard group on the Home tab. The border of the selected cells
will change appearance.

 Select the cell or cells where you want to paste the information.
 Click the Paste command. The cut information will be removed from the original cells and now
appear in the new cells.
The keyboard shortcut for Paste is the Control Key and the V key.

To Drag and Drop Information:

 Select the cell or cells you wish to move.


 Position your mouse pointer near one of the outside edges of the selected cells. The mouse
pointer changes from a large, white cross to a black cross with 4 arrows.

 Left-click and hold the mouse button and drag the cells to the new location.
 Release the mouse button and the information appears in the new location.

To Use the Fill Handle to Fill Cells:

 Position your cursor over the fill handle until the large white cross becomes a thin, black cross.

 Left-click your mouse and drag it until all the cells you want to fill are highlighted.

 Release the mouse button and all the selected cells are filled with the information from the
original cell.

The fill handle doesn't always copy information from one cell directly into another cell.
Depending on the data entered in the cell, it may fill the data in other ways. For example, if I
have the formula =A1+B1 in cell C1, and I use the fill handle to fill the formula into cell C2, the
formula doesn't appear the same in C2 as it does in C1. Instead of =A1+B1, you will see
=A2+B2.

You can use the fill handle to fill cells horizontally or vertically.

Challenge!

Use the Budget or any Excel workbook you choose to complete this challenge.

 Copy and paste information from one cell to another cell.


 Use the Cut command to remove information from one cell and then paste it into another
cell.
 Use the fill handle to fill 2 or more cells.
 Drag and drop information from one place in the spreadsheet to another location.

Printing Workbooks

In Excel, there are many things you can do to prepare your


workbook for printing. Many of these tasks make it easier to format the spreadsheet for the
printed page.

In this lesson you will learn how to view the spreadsheet in print preview, modify margins,
change the page orientation, use the scale to fit feature, use the Print Titles command, insert
breaks, and more.

Preparing to Print and Printing

Watch the video! (10:14 min) - Tips for watching our videos.

Download the example to work along with the video.


To View the Spreadsheet in Print Preview:

 Left-click the Microsoft Office Button.


 Select Print.
 Select Print Preview. The spreadsheet will appear in Print Preview view.

Click the Close Print Preview button to return to the Normal View.

To make previewing your spreadsheet easier, add the Print Preview command to the Quick
Access toolbar.

Exploring Print Preview:

Once you are in Print Preview, you can access many of the same features that you can from the
Ribbon; however, in Print Preview you can see how the spreadsheet will appear in printed
format.
To Modify Margins, Column Width, or Row Height While in Print Preview:

 Click the Print Preview command on the Quick Access toolbar, or select Print Preview from the
Microsoft Office Button menu. The spreadsheet opens in print preview mode.
 Hover your cursor over one of the black margin markers until a double arrow appears.
 Left-click and drag the marker to the desired location. The change will be reflected in the
spreadsheet.

To Modify Margins:

 Select the Page Layout tab.


 Left-click the Margins command.
 Choose one of the predefined settings or enter custom margins.

To Change Page Orientation:

 Select the Page Layout tab.


 Left-click the Orientation command.
 Select either Portrait or Landscape.
Portrait orients the page vertically, while Landscape orients the page horizontally.

To Use Scale to Fit:

 Select the Page Layout tab.


 Locate the Scale to Fit group.
 Enter a specific height and width, or use the percentage field to decrease the spreadsheet by a
specific percent.

Scale to Fit is a useful feature that can help you format spreadsheets to fit on a page. Be careful
with how small you scale the information -- it can become difficult to read!

To Change the Paper Size:

 Select the Page Layout tab.


 Click the Size command.
 Select a size option from the list.

To Define a Print Area:

 Left-click and drag your mouse to select the cells you wish to print.
 Click the Print Area command.
 Choose Set Print Area.
Now, only the selected cells will print. You can confirm this by viewing the spreadsheet in Print
Preview.

To return to the default setting, which is the entire worksheet, click the Print Area command and
select Clear Print Area.

To Insert a Break:

 Select a cell below where you want the break to appear.


 Select the Breaks command.
 Select Insert Break.

Click Print Preview to confirm the break appears in the correct place in your spreadsheet.

To Use the Print Titles command:

This is an important command to be familiar with if you intend to print your worksheets. It
allows you to select specific rows and/or columns to appear on each printed sheet. Imagine how
difficult it would be to read page 48 of a printed spreadsheet if the column and row headings
only appeared on the first page.

 Select the Page Layout tab.


 Click the Print Titles command. The Page Setup dialog box appears.
 Click the icon at the end of the field.
 Select the first row in the spreadsheet that you want to appear on each printed page.

 Repeat for the column, if necessary.


 Click OK.

To Print from the Microsoft Office Button:

 Left-click the Microsoft Office Button.


 Select Print Print. The Print dialog box appears.

 Select a printer if you wish to use a printer other than the default setting.
 Click Properties to change any necessary settings.
 Choose whether you want to print specific pages, all of the worksheet, a selected area, the
active sheet, or the entire workbook.
 Select the number of copies you'd like to print.
 Click OK.

You can select Quick Print to bypass the Print dialog box.

Challenge!

Use the Budget or any Excel workbook you choose to complete this challenge.

 View the spreadsheet in Print Preview.


 Change a column width in Print Preview.
 Insert a break.
 Use the Print Titles command to print a specific row or column on each printed page.
Use Print Preview to verify how this will appear.
 Print the spreadsheet.
 Explore the other commands discussed in this lesson.

Creating Complex Formulas

Excel is a spreadsheet application and is intended to be used to


calculate and analyze numerical information such as household budgets, company finances,
inventory, and more. To do this, you need to understand formulas.

In this lesson, we’ll discuss complex formulas that use multiple mathematical operators, and
that use absolute and relative references.

Complex Formulas

Watch the video! (12:26 min) - Tips for watching our videos.

Download the example to work along with the video.


Complex Formulas Defined

Simple formulas have one mathematical operation. Complex formulas involve more than one
mathematical operation.

Simple Formula: =2+2


Complex Formula: =2+2*8

To calculate complex formulas correctly, you must perform certain operations before others.
This is defined in the order of operations.

The Order of Operations

The order of mathematical operations is very important. If you enter a formula that contains
several operations, Excel knows to work those operations in a specific order. The order of
operations is:

1. Operations enclosed in parenthesis


2. Exponential calculations (to the power of)
3. Multiplication and division, whichever comes first
4. Addition and subtraction, whichever comes first

A mnemonic that can help you remember this is Please Excuse My Dear Aunt Sally
(P.E.M.D.A.S).

Example 1

Using this order, let us see how the formula 20/(8-4)*8-2 is calculated in the following
breakdown:
Example 2

3+3*2=?

Is the answer 12 or 9? Well, if you calculated in the order in which the numbers appear, 3+3*2,
you'd get the wrong answer, 12. You must follow the order of operations to get the correct
answer.

To Calculate the Correct Answer:

1. Calculate 3*2 first because multiplication comes before addition in the order of operations. The
answer is 6.
2. Add the answer obtained in step #1, which is 6, to the number 3 that opened the equation. In
other words, add 3 + 6.
3. The answer is 9.
4. Complex Formulas (continued)
5. Before moving on, let's explore some more formulas to make sure you understand the
order of operations by which Excel calculates the answer.

4*2/4 Multiply 4*2 before performing the


division operation because the
multiplication sign comes before the
division sign. The answer is 2.

4/2*4 Divide 4 by 2 before performing the


multiplication operation because the
division sign comes before the
multiplication sign. The answer is 8.

4/(2*4) Perform the operation in parentheses


(2*4) first and divide 4 by this result.
The answer is 0.5.

4-2*4 Multiply 2*4 before performing the


subtraction operation because the
multiplication sign is of a higher order
than the subtraction sign. The answer
is -4.

Creating Complex Formulas

Excel automatically follows a standard order of operations in a complex formula. If you want
a certain portion of the formula to be calculated first, put it in parentheses.

Example of How to Write a Complex Formula:

 Click the cell where you want the formula result to appear. In this example, H6.
 Type the equal sign (=) to let Excel know a formula is being defined.
 Type an open parenthesis, or (
 Click on the first cell to be included in the formula (G6, for example).
 Type the addition sign (+) to let Excel know that an add operation is to be performed.
 Click on the second cell in the formula (G7, for example)
 Type a close parentheses ).

 Type the next mathematical operator, or the division symbol (/) to let Excel know that a division
operation is to be performed.
 Type an open parenthesis, or (
 Click on the third cell to be included in the formula (D6, for example).
 Type the addition sign (+) to let Excel know that an add operation is to be performed.
 Click on the fourth cell to be included in formula. (D7, for example).
 Type a close parentheses ).

 Very Important: Press Enter or click the Enter button on the Formula bar. This step ends the
formula.

To show fewer decimal places, you can just click the Decrease Decimal place command on the
Home tab.

What is an Absolute Reference?

In earlier lessons we saw how cell references in formulas automatically adjust to new locations
when the formula is pasted into different cells. This is called a relative reference.
Sometimes, when you copy and paste a formula, you don't want one or more cell references to
change. Absolute reference solves this problem. Absolute cell references in a formula always
refer to the same cell or cell range in a formula. If a formula is copied to a different location, the
absolute reference remains the same.

An absolute reference is designated in the formula by the addition of a dollar sign ($). It can
precede the column reference or the row reference, or both. Examples of absolute referencing
include:

To Create an Absolute Reference:

 Select the cell where you wish to write the formula (in this example, H2)
 Type the equal sign (=) to let Excel know a formula is being defined.
 Click on the first cell to be included in the formula (F2, for example).
 Enter a mathematical operator (use the multiplication symbol for this example).
 Click on the second cell in the formula (C2, for example).
 Add a $ sign before the C and a $ sign before the 2 to create an absolute reference.

 Copy the formula into H3. The new formula should read =F3*$C$2. The F2 reference changed to
F3 since it is a relative reference, but C2 remained constant since you created an absolute
reference by inserting the dollar signs.
Challenge!

Use the Inventory or any Excel workbook you choose to complete this challenge.

 Create at least one complex formula that uses the addition and division operations.
 Create at least one complex formula that uses parentheses and a multiplication
operation.
 Create a formula that uses an absolute reference.

Working with Basic Functions

A function is a predefined formula that performs calculations


using specific values in a particular order. While you may think of formulas as being short
mathematical equations, like 2 + 2 or F2 * C2, they can actually be very lengthy and involve
complex mathematical calculations.

One of the key benefits of functions is that they can save you time since you do not have to write
the formula yourself. For example, you could use an Excel function called Average to quickly
find the average of a range of numbers or the Sum function to find the sum of a cell range.

In this lesson, you will learn how to use basic functions such as SUM and AVG, use functions
with more than one argument, and how to access the other Excel 2007 functions.

Basic Functions
Watch the video! (11:34 min) - Tips for watching our videos.

Download the example to work along with the video.

The Parts of a Function:

Each function has a specific order, called syntax, which must be strictly followed for the
function to work correctly.

Syntax Order:

1. All functions begin with the = sign.


2. After the = sign define the function name (e.g., Sum).
3. Then there will be an argument. An argument is the cell range or cell references that are
enclosed by parentheses. If there is more than one argument, separate each by a comma.

An example of a function with one argument that adds a range of cells, A3 through A9:

An example of a function with more than one argument that calculates the sum of two cell
ranges:

Excel literally has hundreds of different functions to assist with your calculations. Building
formulas can be difficult and time-consuming. Excel's functions can save you a lot of time and
headaches.

Excel's Different Functions


There are many different functions in Excel 2007. Some of the more common functions include:

Statistical Functions:

 SUM - summation adds a range of cells together.


 AVERAGE - average calculates the average of a range of cells.
 COUNT - counts the number of chosen data in a range of cells.
 MAX - identifies the largest number in a range of cells.
 MIN - identifies the smallest number in a range of cells.

Financial Functions:

 Interest Rates
 Loan Payments
 Depreciation Amounts

Date and Time functions:

 DATE - Converts a serial number to a day of the month


 Day of Week
 DAYS360 - Calculates the number of days between two dates based on a 360-day year
 TIME - Returns the serial number of a particular time
 HOUR - Converts a serial number to an hour
 MINUTE - Converts a serial number to a minute
 TODAY - Returns the serial number of today's date
 MONTH - Converts a serial number to a month
 YEAR - Converts a serial number to a year

You don't have to memorize the functions but should have an idea of what each can do for you.

To Calculate the Sum of a Range of Data Using AutoSum:

 Select the Formulas tab.


 Locate the Function Library group. From here, you can access all the available functions.
 Select the cell where you want the function to appear. In this example, select G42.
 Select the drop-down arrow next to the AutoSum command.
 Select Sum. A formula will appear in the selected cell, G42.
o This formula, =SUM(G2:G41), is called a function. AutoSum command automatically
selects the range of cells from G2 to G41, based on where you inserted the function. You
can alter the cell range, if necessary.
 Press the Enter key or Enter button on the formula bar. The total will appear.

To Edit a Function:

 Select the cell where the function is defined.


 Insert the cursor in the formula bar.
 Edit the range by deleting and changing necessary cell numbers.
 Click the Enter icon.

To Calculate the Sum of Two Arguments:

 Select the cell where you want the function to appear. In this example, G44.
 Click the Insert Function command on the Formulas tab. A dialog box appears.
 SUM is selected by default.
 Click OK and the Function Arguments dialog box appears so that you can enter the range of cells
for the function.
 Insert the cursor in the Number 1 field.
 In the spreadsheet, select the first range of cells. In this example, G21 through G26. The
argument appears in the Number 1 field.
o To select the cells, left-click cell G21 and drag the cursor to G26, and then release the
mouse button.
 Insert the cursor in the Number 2 field.
 In the spreadsheet, select the second range of cells. In this example, G40 through G41. The
argument appears in the Number 2 field.
 Notice that both arguments appear in the function in cell G44 and the formula bar when G44 is
selected.

 Click OK in the dialog box and the sum of the two ranges is calculated.

To Calculate the Average of a Range of Data:

 Select the cell where you want the function to appear.


 Click the drop-down arrow next to the AutoSum command.
 Select Average.
 Click on the first cell (in this example, C8) to be included in the formula.
 Left-click and drag the mouse to define a cell range (C8 through cell C20, in this example).
 Click the Enter icon to calculate the average.

Accessing Excel 2007 Functions

To Access Other Functions in Excel:

 Using the point-click-drag method, select a cell range to be included in the formula.
 On the Formulas tab, click on the drop-down part of the AutoSum button.
 If you don't see the function you want to use (Sum, Average, Count, Max, Min), display
additional functions by selecting More Functions.
 The Insert Function dialog box opens.
 There are three ways to locate a function in the Insert Function dialog box:

You can type a question in the Search for a function box and click GO, or

You can scroll through the alphabetical list of functions in the Select a function field, or

You can select a function category in the Select a category drop-down list and review the
corresponding function names in the Select a function field.

 Select the function you want to use and then click the OK button.
Challenge!

Use the Inventory workbook or any workbook you choose to complete this challenge.

 Use a SUM function to calculate the sum of one argument.


 Use the AVG function to calculate the sum of a range of cells.
 Explore the other Excel 2007 functions.

Sorting, Grouping, and Filtering Cells

A Microsoft Excel spreadsheet can contain a great deal of


information. With more rows and columns than previous versions, Excel 2007 gives you the
ability to analyze and work with an enormous amount of data. To most effectively use this
data, you may need to manipulate this data in different ways.

In this lesson, you will learn how to sort, group, and filter data in various ways that will enable
you to most effectively and efficiently use spreadsheets to locate and analyze information.

Sorting, Grouping, and Filtering

Watch the video! (10:13min) - Tips for watching our videos.

Download the example to work along with the video.

A Microsoft Excel spreadsheet can contain a great deal of information. Sometimes you may find
that you need to reorder or sort that information, create groups, or filter information to be able to
use it most effectively.

Sorting
Sorting lists is a common spreadsheet task that allows you to easily reorder your data. The most
common type of sorting is alphabetical ordering, which you can do in ascending or descending
order.

To Sort in Alphabetical Order:

 Select a cell in the column you want to sort (In this example, we choose a cell in column A).
 Click the Sort & Filter command in the Editing group on the Home tab.
 Select Sort A to Z. Now the information in the Category column is organized in alphabetical
order.

You can search in reverse alphabetical order by choosing Sort Z to A in the list.

To Sort from Smallest to Largest:

 Select a cell in the column you want to sort (a column with numbers).
 Click the Sort & Filter command in the Editing group on the Home tab.
 Select From Smallest to Largest. Now the information is organized from the smallest to largest
amount.

You can sort in reverse numerical order by choosing From Largest to Smallest in the list.

To Sort Multiple Levels:

 Click the Sort & Filter command in the Editing group on the Home tab.
 Select Custom Sort from the list to open the dialog box.
OR

 Select the Data tab.


 Locate the Sort and Filter group.
 Click the Sort command to open the Custom Sort dialog box. From here, you can sort by one
item, or multiple items.

 Click the drop-down arrow in the Column Sort by field, and choose one of the options. In this
example, Category.

 Choose what to sort on. In this example, we'll leave the default as Value.
 Choose how to order the results. Leave it as A to Z so it is organized alphabetically.
 Click Add Level to add another item to sort by.
 Select an option in the Column Then by field. In this example, we chose Unit Cost.
 Choose what to sort on. In this example, we'll leave the default as Value.
 Choose how to order the results. Leave it as smallest to largest.
 Click OK.

The spreadsheet has been sorted. All the categories are organized in alphabetical order, and
within each category, the unit cost is arranged from smallest to largest.

Remember all of the information and data is still here. It's just in a different order.

Grouping Cells Using the Subtotal Command


Grouping is a really useful Excel feature that gives you control over how the information is
displayed. You must sort before you can group. In this section we will learn how to create
groups using the Subtotal command.

To Create Groups with Subtotals:

 Select any cell with information in it.


 Click the Subtotal command. The information in your spreadsheet is automatically selected and
the Subtotal dialog box appears.

 Decide how you want things grouped. In this example, we will organize by Category.
 Select a function. In this example, we will leave the SUM function selected.
 Select the column you want the Subtotal to appear. In this example, Total Cost is selected by
default.
 Click OK. The selected cells are organized into groups with subtotals.
To Collapse or Display the Group:

 Click the black minus sign, which is the hide detail icon, to collapse the group.
 Click the black plus sign, which is the show detail icon, to expand the group.
 Use the Show Details and Hide Details commands in the Outline group to collapse and display
the group, as well.

To Ungroup Select Cells:

 Select the cells you want to remove from the group.


 Click the Ungroup command.
 Select Ungroup from the list. A dialog box will appear.
 Click OK.

To Ungroup the Entire Worksheet:

 Select all the cells with grouping.


 Click Clear Outline from the menu.

Filtering Cells

Filtering, or temporarily hiding, data in a spreadsheet very easy. This allows you to focus on
specific spreadsheet entries.
To Filter Data:

 Click the Filter command on the Data tab. Drop-down arrows will appear beside each column
heading.

 Click the drop-down arrow next to the heading you would like to filter. For example, if you
would like to only view data regarding Flavors, click the drop-down arrow next to Category.
 Uncheck Select All.
 Choose Flavor.
 Click OK. All other data will be filtered, or hidden, and only the Flavor data is visible.

To Clear One Filter:

 Select one of the drop-down arrows next to a filtered column.


 Choose Clear Filter From....
To remove all filters, click the Filter command.

Filtering may look a little like grouping, but the difference is that now I can filter on another
field, if I want to. For example, let’s say I want to see only the Vanilla-related flavors. I can
click the drop-down arrow next to Item, and select Text Filters. From the menu, I’ll choose
Contains because I want to find any entry that has the word vanilla in it. A dialog box appears.
We’ll type Vanilla, and then click OK. Now we can see that the data has been filtered again and
that only the Vanilla-related flavors appear.

Challenge!

Use the Inventory workbook or any workbook you choose to complete this challenge.

 Use the Sort command to sort data alphabetically.


 Use the Sort command to sort data numerically from smallest to largest.
 Create groups using the Subtotal command.
 Practice using the Filter command.

Formatting Tables
Once you have entered information into a spreadsheet, you may
want to format it. Formatting your spreadsheet can not only make it look nicer, but make it
easier to use. In a previous lesson we discussed many manual formatting options such as bold
and italics. In this lesson, you will learn how to use the predefined tables styles in Excel 2007
and some of the Table Tools on the Design tab.

Formatting Tables

Watch the video! (3:45 min) - Tips for watching our videos.

Download the example to work along with the video.

To Format Information as a Table:

 Select any cell that contains information.


 Click the Format as Table command in the Styles group on the Home tab. A list of predefined
tables will appear.
 Left-click a table style to select it.
 A dialog box will appear. Excel has automatically selected the cells for your table. The cells will
appear selected in the spreadsheet and the range will appear in the dialog box.

 Change the range listed in the field, if necessary.


 Verify the box is selected to indicate your table has headings, if it does. Deselect this box if your
table does not have column headings.
 Click OK. The table will appear formatted in the style you chose.
By default, the table will be set up with the drop-down arrows in the header so that you can
filter the table, if you wish.

In addition to using the Format as Table command, you can also select the Insert tab, and click
the Table command to insert a table.

To Modify a Table:

 Select any cell in the table. The Table Tools Design tab will become active. From here you can
modify the table in many ways.

You can:

 Select a different table in the Table Styles Options group. Click the More drop-down arrow to
see more table styles.
 Delete or add a Header Row in the Table Styles Options group.
 Insert a Total Row in the Table Styles Options group.
 Remove or add banded rows or columns.
 Make the first and last columns bold.
 Name your table in the Properties group.
 Change the cells that make up the table by clicking Resize Table.

When you apply a table style, filtering arrows automatically appear. To turn off filtering, select
the Home tab, click the Sort & Filter command, and select Filter from the list.

Challenge!

Use the Inventory workbook or any workbook you choose to complete this challenge.

 Format the information in a worksheet as a table.


 Format the first column in bold.
 Name the table.
 Change the table style.
 Practice using the other features discussed in this lesson to modify the table in various
ways.

Aligning Text

Worksheets that have not been formatted are often very difficult
to read. Fortunately, Excel gives you many tools that allow you to format text and tables in
various ways. One of the ways you can format your worksheet so that it is easier to work with is
to apply different types of alignment to text.

In this lesson, you will learn how to left, center, and right align text, merge and center cells,
vertically align text, and apply different types of text control.

Formatting Cells

Watch the video! (5:17 min) - Tips for watching our videos.

Download the example to work along with the video.

Aligning Text

Excel 2007 left-aligns text (labels) and right-aligns numbers (values). This makes data easier
to read, but you do not have to use these defaults. Text and numbers can be defined as left-
aligned, right-aligned or centered in Excel.

To Align Text or Numbers in a Cell:

 Select a cell or range of cells


 Click on either the Align Left, Center or Align Right commands on the Home tab.
 The text or numbers in the cell(s) take on the selected alignment treatment.

Left-click a column label to select the entire column, or a row label to select an entire row.

Changing Vertical Cell Alignment

You can also define vertical alignment in a cell. In Vertical alignment, information in a cell can
be located at the top of the cell, middle of the cell or bottom of the cell. The default is bottom.

To Change Vertical Alignment from the Alignment Group:

 Select a cell or range of cells.


 Click the Top Align, Center, or Bottom Align command.

Changing Text Control


Text Control allows you to control the way Excel 2007 presents information in a cell. There are
two common types of Text control: Wrapped Text and Merge Cells.

The Wrapped Text wraps the contents of a cell across several lines if it's too large than the
column width. It increases the height of the cell as well.

Merge Cells can also be applied by using the Merge and Center button on the Home tab.

To Change Text Control:

 Select a cell or range of cells.


 Select the Home tab.
 Click the Wrap Text command or the Merge and Center command.

If you change your mind, click the drop-down arrow next to the command, and choose Unmerge
cells.

Challenge!
Use the Inventory workbook or any workbook you choose to complete this challenge.

 Insert a row and center-align the text.


 Insert a column and left-align the text.
 Use the merge and center command to add a title row.
 Apply the wrapped text command to the entire table.
 Practice using the other features discussed in this lesson.

Working with Worksheets

It is important that you know how to effectively manage your


worksheets. By default, three worksheets appear in each new workbook. In this lesson, you will
learn how to name, add. delete, group, and ungroup worksheets. Additionally, you will learn how
to freeze specific parts of the worksheet so they are always visible.

Worksheets

Watch the video! (9:03 min) - Tips for watching our videos.

Download the example to work along with the video.

Naming Worksheets

When you open an Excel workbook, there are three sheets by default and the default name on
the tabs are Sheet1, Sheet2 and Sheet3. These are not very informative names. Excel 2007 allows
you to define a meaningful name for each worksheet in a workbook so you can quickly locate
information.
To Name a Worksheet:

 Right-click the sheet tab to select it.


 Choose Rename from the menu that appears. The text is highlighted by a black box.

 Type a new name for the worksheet.

 Click off the tab. The worksheet now assumes the descriptive name defined.

OR

 Click the Format command in the Cells group on the Home tab.
 Select Rename Sheet. The text is highlighted by a black box.
 Type a new name for the worksheet.
 Click off the tab. The worksheet now assumes the descriptive name defined.

nserting Worksheets

You can change the default number of sheets that appear by clicking the Microsoft Office
Button and choosing Excel Options. You also have the ability to insert new worksheets if
needed, while you are working.
To Insert a New Worksheet:

 Left-click the Insert Worksheet icon. A new sheet will appear. It will be named Sheet4, Sheet5 or
whatever the next sequential sheet number may be in the workbook.

OR

 Press the Shift and the F11 keys on your keyboard.

Deleting Worksheets

Any worksheet can be deleted from a workbook, including those that have data in it. Remember,
a workbook must contain at least one worksheet.

To Delete One or More Worksheets:

 Click on the sheet(s) you want to delete.


 Right-click the sheet(s) and a menu appears.
 Select Delete.

OR
 Select the sheet you want to remove.
 Click the drop-down arrow next to Delete in the Cells group on the Home tab.
 From the menu that appears, select Delete Sheet.

Grouping and Ungrouping Worksheets

A workbook is a multi-page Excel document that contains multiple worksheets. Sometimes you
will want to work with the worksheets one at a time as if each is a single unit. Other times, the
same information or formatting may need to be added to every worksheet.

Worksheets can be combined together into a group. Grouping worksheets allows you to apply
identical formulas and/or formatting across all the worksheets in the group. When you group
worksheets, any changes made to one worksheet will also be changed in any other worksheets
in the group.

To Group Contiguous Worksheets:

 Select the first sheet you want to group.


 Press and hold the Shift key on your keyboard.
 Click the last sheet you want to group.

 Release the Shift key.


 The sheets are now grouped. All the sheets between the first sheet and last sheet selected are
part of the group. The sheet tabs will appear white for the grouped sheets.

 Make any changes to one sheet and the changes will appear in all the grouped sheets.

To Group Non-Contiguous Sheets:

 Select the first sheet you want to group.


 Press and hold the Ctrl key on your keyboard.
 Click the next sheet you want to group.
 Continuing clicking the sheets you want to group.
 Release the Control key.
 The sheets are now grouped. The sheet tabs will appear white for the grouped sheets. Only the
sheets selected are part of the group.
 Make any changes to one sheet and the changes will appear in all the grouped sheets.

To Ungroup Worksheets:

 Right-click one of the sheets.


 Select Ungroup from the list.

Freezing Worksheet Panes

The ability to freeze, or lock, specific rows or columns in your spreadsheet is a really useful
feature in Excel. It is called freezing panes. When you freeze panes, you select rows or columns
that will remain visible all the time, even as you are scrolling. This is particularly useful when
working with large spreadsheets.

To Freeze a Row:

 Select the row below the one that you want frozen. For example, if you want row 1 & 2 to
appear at the top even as you scroll, then select row 3.

 Click the View tab.


 Click the Freeze Pane command in the Window group.
 Choose Freeze Panes. A thin, black line appears below everything that is frozen in place.

 Scroll down in the worksheet to see the pinned rows.

To Unfreeze a Pane:

 Click the Freeze Pane command.


 Select the Unfreeze command.

To Freeze a Column:

 Select the column to the right of the column(s) you want frozen. For example, if you want
columns A & B to always appear on the left, just select column C.
 Click the View tab.
 Click the Freeze Pane command in the Window group.
 Choose Freeze Pane. A thin, black line appears to the right of the frozen area.
 Scroll across in the worksheet to see the pinned columns.

Challenge!

Use the Inventory workbook or any workbook you choose to complete this challenge.

 Rename Sheet1 to January, Sheet2 to February and Sheet3 to March.


 Insert two worksheets and name them April and May.
 If necessary, move the April and May worksheets so they are immediately following the
March sheet.
 Use the Grouping feature so that all the sheets contain the same information as the
January sheet.
 Delete the May sheet.
 Freeze rows 1 and 2 on the January sheet.

Using Templates

In Excel 2007, you have many templates that can save you a lot
of time. A template is a pre-designed spreadsheet that you can use to create new spreadsheets
with the same formatting and predefined formulas. With templates, you don't need to know
how to do the math, or even how to write formulas -- these are already integrated into the
spreadsheet.

In this lesson, you will learn how to create a new workbook with a template, as well as basic
information about how templates work in Excel 2007.

Templates

Watch the video! (3:30 min) - Tips for watching our videos.

Excel allows you to create new workbooks using templates, or a predefined pattern. Several
templates are preloaded in Excel and others are located on Microsoft Office Online.
To Create New Workbooks Using Templates On Your Computer:

 Open Excel.
 Click the Microsoft Office Button.
 Select New. The New Workbook Dialog Box appears.

 Click Installed Templates. Thumbnail images of the templates that are installed on your
computer appear in the center of the dialog box.
 Select a template from the center area of the dialog box. A slightly larger image of the template
appears on the right side of the dialog box.
 Click Create. The template will appear in the Excel window.

To Create New Workbooks Using Templates on Office Online:

 Open Excel.
 Click Microsoft Office Button.
 Select New. The New Workbook Dialog Box appears.
 Select a category under the Microsoft Office Online heading on the left. Thumbnail images of
the templates in that category that are available through Microsoft Office Online appear in the
center of the dialog box.
 Select a template. A slightly larger image of the template appears on the right side of the dialog
box.
 Click Download. The download process will begin.

Challenge!

 Open Excel.
 View the templates on your computer.
 View several of the template categories on Microsoft Office Online.
 Select a template.
 Download the template.
 Enter your data into the template.
 Save and close the workbook.

Using What-if Analysis


The real power in Excel comes in its ability to perform multiple
mathematical calculations for you. One of the tools in Excel that you can use to perform these
calculations is a Data tool called What-If Analysis. What-If analysis allows you to see the
effect that different values have in formulas. Have you ever thought, "What interest rate do I
need to qualify for to have a car payment of $400 on the car I want?" This question can be
answered using What-If Analysis.

In this lesson, you will learn how to use a What-If Analysis tool called Goal Seek.

What-if Analysis

Watch the video! (5:18min) - Tips for watching our videos.

Download the example to work along with the video.

Example

You need a loan to buy a new car. You know how much money you want to borrow, how long
of a period you want to take to pay off the loan (the term), and what payment you can afford to
make each month. But, what you need to know is what interest rate you to qualify for to make
the payment $400 a month. In the image below, you can see that if you didn’t have interest and
just divided this $20,000 into 60 monthly payments, you would pay $333.33 a month. The
What-If Analysis tool will allow you to easily calculate the interest rate.
Where Did the Formula Come From?

The formula that appears in cell B5 in the example image is a function. It isn't part of the What-
if Analysis tool, so you will need to understand functions thoroughly before you use What-if
Analysis. For the example scenario described above, you need a formula that will calculate the
monthly payment. Instead of writing the formula yourself, you can insert a function to do the
calculation for you.

To Insert a Payment Function:

 Select the Formula tab.


 Click the Insert Function command. A dialog box appears.
 Select PMT.
 Click OK. A dialog box appears.
 Insert your cursor in the first field. A description about the needed information appears at the
bottom of the dialog box.
 Select the cell in the spreadsheet with the needed information.
 Insert your cursor in the next field. A description about the needed information appears at the
bottom of the dialog box.
 Select the cell in the spreadsheet with the needed information.
 Repeat the last two steps until all the necessary information is entered in the dialog box.
 Click OK.

What-If Analysis Tools

There are three What-If analysis tools that you can use. To access these, select the Data tab, and
locate the What-If Analysis command. If you click this command, a menu with three options
appears.

Goal seek is useful if you know the needed result, but need to find the input value that will give
you the desired result. In this example, we know the desired result (a $400 monthly payment),
and are seeking the input value (the interest rate).

Goal Seek

To Use Goal Seek to Determine an Interest Rate:

 Select the Data tab.


 Locate the Data Tools group.
 Click the What-If Analysis command. A list of three options appears.
 Select Goal Seek. A small dialog box appears.
 Select the cell that you what to set to a specific value. In this example, we want to set B5, the
Payment cell.

 Insert the cursor in the next field.


 Enter a value in the value field. In this example, type -$400. Since we’re making a payment that
will be subtracted from our loan amount, we have to enter the payment as a negative number.

 Insert the cursor in the next field.


 Select the cell that you want to change. This will be the cell that tries various input values. In
this example, select cell B4, which is the interest rate.

 Click OK.
 Then, click OK again. The interest rate appears in the cell. This indicates that a 7% interest rate
will give us a $400 a month payment on a $20,000 loan that is paid off over 5 years, or 60
months.

Challenge!

Use the Car Loan workbook to complete this challenge.

 Use Goal Seek to solve the problem described in the text and video lessons.
 Create a problem of your own that you might use Goal Seek to solve. Try it.

Working with Charts


A chart is a tool you can use in Excel to communicate your data
graphically. Charts allow your audience to more easily see the meaning behind the numbers in
the spreadsheet, and make showing comparisons and trends a lot easier. In this lesson, you will
learn how to insert and modify Excel charts and see how they can be an effective tool for
communicating information.

Charts

Watch the video! (9:25 min) - Tips for watching our videos.

Download the example to work along with the video.

Creating a Chart

Charts can be a useful way to communicate data. When you insert a chart in Excel, it appears in
the selected worksheet with the source data, by default.

To Create a Chart:

 Select the worksheet you want to work with. In this example, we use the Summary worksheet.
 Select the cells that you want to chart, including the column titles and the row labels.
 Click the Insert tab.
 Hover over each Chart option in the Charts group to learn more about it.
 Select one of the Chart options. In this example, we use the Columns command.
 Select a type of chart from the list that appears. For this example, we use a 2-D Clustered
Column. The chart appears in the worksheet.
Identifying the Parts of a Chart

Have you ever read something you didn't fully understand but when you saw a chart or graph,
the concept became clear and understandable? Charts are a visual representation of data in a
worksheet. Charts make it easy to see comparisons, patterns, and trends in the data.

Source Data

The range of cells that make up a chart. The chart is updated automatically whenever the
information in these cells change.
Title

The title of the chart.

Legend

The chart key, which identifies each color on the chart represents.

Axis

The vertical and horizontal parts of a chart. The vertical axis is often referred to as the Y axis,
and the horizontal axis is referred to as the X axis.

Data Series

The actual charted values, usually rows or columns of the source data.

Value Axis

The axis that represents the values or units of the source data.

Category Axis

The axis identifying each data series.

Chart Tools

Once you insert a chart, a new set of Chart Tools, arranged into 3 tabs, will appear above the
Ribbon. These are only visible when the chart is selected.

To Change the Chart Type:

 Select the Design tab.


 Click the Change Chart Type command. A dialog box appears.

 Select another chart type.


 Click OK.

The chart in the example compares each salesperson's monthly sales to his/her other month's
sales; however you can change what is being compared. Just click the Switch Row/Column
Data command, which will rotate the data displayed on the x and y axes. To return to the
original view, click the Switch Row/Column command again.

To Change Chart Layout:

 Select the Design tab.


 Locate the Chart Layouts group.
 Click the More arrow to view all your layout options.

 Left-click a layout to select it.

If your new layout includes chart titles, axes, or legend labels, just insert your cursor into the text
and begin typing to add your own text.
To Change Chart Style:

 Select the Design tab.


 Locate the Chart Style group.
 Click the More arrow to view all your style options.
 Left-click a style to select it.

To Move the Chart to a Different Worksheet:

 Select the Design tab.


 Click the Move Chart command. A dialog box appears. The current location of the chart is
selected.
 Select the desired location for the chart (i.e., choose an existing worksheet, or select New Sheet
and name it).

Challenge!

Use the Company Sales workbook or any other workbook to complete this challenge.

 Use worksheet data to create a chart.


 Change the chart layout.
 Apply a chart style.
 Move the chart to a separate worksheet.

Using Conditional Formatting

Imagine you have a spreadsheet with thousands of rows of data.


It would be extremely difficult to see patterns and trends just from examining the raw data. Excel
gives us several tools that will make this task easier. One of these tools is called conditional
formatting. With conditional formatting, you can apply formatting to one or more cells based
on the value of the cell. You can highlight interesting or unusual cell values, and visualize the
data using formatting such as data bars.

In this lesson, you will learn how to apply, modify, and delete conditional formatting rules.

Conditional Formatting

Watch the video! (5:17 min) - Tips for watching our videos.

Download the example to work along with the video.

The Conditional Formatting Options

You have many conditional formatting rules, or options, that you can apply to cells in your
spreadsheet. Each rule will affect selected cells differently. Before you choose a formatting rule,
you need to identify what questions you are trying to answer. For example, in a sales
spreadsheet, you might want to identify the salespeople with lower than average sales. To do
this, you need to choose a conditional formatting rule that will show you this answer. Not all of
the options will provide you with this information.
Some of the Conditional Formatting Options Include:

 Highlight Cell Rules: This rule highlights specific cells based on your option choice. For example,
you can choose for Excel to highlight cells that are greater than, less than, or equal to a number,
and between two numbers. Also, you can choose for Excel to highlight cells that contain specific
text, including a specific date. If you choose this option, a dialog box will appear, and you will
have to specify the cells to highlight, and the color you would like to highlight the cells.

 Top/Bottom Rules: This conditional formatting option highlights cell values that meet specific
criteria, such as top or bottom 10%, above average, and below average. If you choose this
option, a dialog box will appear, and you will have to specify the cells to highlight, and the color
you would like to highlight the cells.
 Data Bars: This is an interesting option that formats the selected cells with colored bars. The
length of the data bar represents the value in the cell. The longer the bar, the higher the value.

 Color Scales: This option applies a two or three color gradient to the cells. Different shades and
colors represent specific values.
To Apply Conditional Formatting:

 Select the cells you would like to format.


 Select the Home tab.
 Locate the Styles group.
 Click the Conditional Formatting command. A menu will appear with your formatting options.

 Select one of the options to apply it to the selected cells. A cascading menu will appear.
 An additional dialog box may appear, depending on the option you choose.
 If so, make the necessary choices, and click OK.

To Remove Conditional Formatting Rules:

 Click the Conditional Formatting command.


 Select Clear Rules. A cascading menu appears.
 Choose to clear rules from the entire worksheet or the selected cells.

To Manage Conditional Formatting Rules:

 Click the Conditional Formatting command.


 Select Manage Rules from the menu. The Conditional Formatting Rules Manager dialog box will
appear.
 From here you can edit a rule, delete a rule, or change the order of rules.

Challenge!

Use the Company Sales workbook to complete this challenge.

 Apply conditional formatting to a range of cells with numerical values.


 Apply a second conditional formatting rule to the same set of cells.
 Apply a conditional formatting rule to a range of cells with text.
 Explore the Conditional Formatting Rules Manager dialog box.
 Clear all conditional formatting rules from the worksheet.

Das könnte Ihnen auch gefallen