learning microsoft excel 2007 - if command

7
Learning Microsoſt Excel 2007 By Greg Bowden Guided Computer Tutorials www.gct.com.au Chapter 11

Upload: guided-computer-tutorials

Post on 16-Nov-2014

6.042 views

Category:

Documents


3 download

DESCRIPTION

Sample pages from Chapter 11 of Learning Microsoft Excel 2007 by Greg Bowden which introduces the IF command which allows Excel to make decisions. It includes simple IF statements, using greater than, less than and greater than or equal to, using AND and OR in IF statements and conditional formatting.

TRANSCRIPT

Page 1: Learning Microsoft Excel 2007 - IF Command

Learning Microsoft Excel 2007By Greg Bowden

Guided Computer Tutorialswww.gct.com.au

Making Decisions With Excel

Chapter 11

Page 2: Learning Microsoft Excel 2007 - IF Command

PUBLISHED BY

GUIDED COMPUTER TUTORIALSPO Box 311Belmont, Victoria, 3216, Australia

www.gct.com.au

© Greg Bowden

This product is available in Single or Multi User versions.

Single-user versions are for single person use at any particular time, just as a single text book would be used. If you intend to use the notes with multiple students the single user version should be upgraded to the multi-user version.

Multi-user versions allow the school or institution to print as many copies as required, or to place the PDF files on the school network, intranet and staff laptops. A certificate of authentication is provided with multi-user versions. Bookmarks provide links to all headings and sub-headings, and individual chapters are provided.

First published 2007

ISBN: 1 921217 44 8 (Module 1) 1 921217 45 6 (Module 2)PDF document on CD-ROM

Every effort has been made to ensure that images used in this publication are free of copyright, but there may be instances where this has not been possible. Guided Computer Tutorials would welcome any information that would redress this situation.

Page 3: Learning Microsoft Excel 2007 - IF Command

© Guided Computer Tutorials 2007 11-1

Chapter

11Making Decisions With Excel

We can instruct a spreadsheet to make decisions on entered labels and values. This is achieved by using the IF function, which takes the form:

IF (something is true, do this, otherwise, do something else)

The IF function uses mathematical symbols (operators) to make comparisons:

Operator Meaning < less than > greater than <= less than or equal to >= greater than or equal to = equal to <> is not equal to

For example, look at the following formula:

=IF(A1>0,A1,0)This formula reads: if the contents of cell A1 is greater than zero then display the contents of A1, otherwise display zero. The sections of an IF statement must be separated by commas. The commas stand for ‘then’ and ‘otherwise’.

The following diagram shows the sections of the formula:

Page 4: Learning Microsoft Excel 2007 - IF Command

© Guided Computer Tutorials 200711-2

Learning Microsoft Excel 2007

The IF Command

A template for a company that gives discounts on items priced over $100 will be used.

1 Load Microsoft Excel 2007 and click on the OPEN icon in the QUICK ACCESS TOOLBAR or in the OFFICE BUTTON.

2 Access the EXCEL 2007 SUPPORT FILES, open the CHAPTER 11 folder and load the CHAPTER 11 file, selecting YES to the READ-ONLY message.

NOTE: The spreadsheet is being told that if the contents of the cell B4 is greater than 100, then display YES, otherwise display NO. Quotation marks are used because YES and NO are LABELS.

3 Move the cursor to cell C4 and enter the formula:

= IF(B4>100,”Yes”,”No”)

4 Autofill the formula down 3 cells and format the 4 labels to CENTRE. You should have a YES displayed next to prices over $100.

Page 5: Learning Microsoft Excel 2007 - IF Command

© Guided Computer Tutorials 2007 11-3

11Making Decisions With Excel

6 Mathematical calculations can also be done within IF functions.

NOTE: i For the “ “, press the double quotation key twice. ii The formula reads: if the value in cell B4 is greater than 100,

then work out and display B4 times 10%, otherwise display a blank space (two quotes entered next to one another).

iii You should receive a blank space in cell C4 as the Radio costs less than $100.

5 Change the cost of the Heater to $95.60 and observe the change.

7 Position the cursor at cell C4, enter:

= IF(B4>100,B4*10%,” “) then press the <enter> key.

Page 6: Learning Microsoft Excel 2007 - IF Command

© Guided Computer Tutorials 200711-4

Learning Microsoft Excel 2007

8 Autofill the formula down for the other 3 cells and format the 4 cells to CURRENCY with two decimal places and RIGHT aligned.

9 Change the price of the Toaster to $137.50. A discount should now be allocated.

10 Change the cost of the Toaster to $100. A discount is not given because the value is not over $100.

Page 7: Learning Microsoft Excel 2007 - IF Command

© Guided Computer Tutorials 2007 11-5

11Making Decisions With Excel

Greater Than or Equal To

Sometimes we need a condition to include a number as well as all greater or smaller numbers. The >= and <= symbols can be used for this purpose.

NOTE: The Toaster receives a discount because a discount is now payable on items of $100 or more.

1 Move the cursor to cell C4 and edit the formula to add an = sign straight after the > sign. Your formula should now be:

= IF(B4>=100,B4*10%,” “)

2 Autofill this formula down the other 3 cells and you should now have a discount for the Toaster.