Lecture 6: Layout, Rounding, Making Decisions OMP 111 · Lecture 6: Layout, Rounding, Making...

13
COMP 111 © Dept of Informatics & Enabling Tech, Lincoln University 2017 All images & figures created by DIET, unless noted Lecture 6: Layout, Rounding, Making Decisions Lecture Goals: More spreadsheet layout More cell format Rounding displays versus rounding values Using Excel rounding functions Using functions to make decisions

Transcript of Lecture 6: Layout, Rounding, Making Decisions OMP 111 · Lecture 6: Layout, Rounding, Making...

Page 1: Lecture 6: Layout, Rounding, Making Decisions OMP 111 · Lecture 6: Layout, Rounding, Making Decisions Lecture Goals: • More spreadsheet layout • More cell format • Rounding

CO

MP

11

1

© Dept of Informatics & Enabling Tech, Lincoln University 2017All images & figures created by DIET, unless noted

Lecture 6: Layout, Rounding, Making Decisions

Lecture Goals:

• More spreadsheet layout

• More cell format

• Rounding displays versus rounding values

• Using Excel rounding functions

• Using functions to make decisions

Page 2: Lecture 6: Layout, Rounding, Making Decisions OMP 111 · Lecture 6: Layout, Rounding, Making Decisions Lecture Goals: • More spreadsheet layout • More cell format • Rounding

© Lincoln University 2017

More on Spreadsheet Layout

- 2 -

• Try not to leave blank rows or columns within ranges of data

• Always label columns (with sensible names)

• Place values that will be used more than once in their own cells

• Use range names for cells that will be used in formulas and where values may change

• Name all worksheets

• Save and close a sheet/workbook in the cell you want highlighted when re-opened

Page 3: Lecture 6: Layout, Rounding, Making Decisions OMP 111 · Lecture 6: Layout, Rounding, Making Decisions Lecture Goals: • More spreadsheet layout • More cell format • Rounding

© Lincoln University 2017

Cell formatting again

- 3 -

Formatting refers to how the contents of a cell look.

• Can refer to type of number format used, or colour, font, etc

• Can refer to the number of decimal places displayed

Page 4: Lecture 6: Layout, Rounding, Making Decisions OMP 111 · Lecture 6: Layout, Rounding, Making Decisions Lecture Goals: • More spreadsheet layout • More cell format • Rounding

© Lincoln University 2017

Rounding the cell display

- 4 -

• Adjusting the decimal value to be displayed is sometimes referred to as rounding …however this “rounds” only the display not the value

Page 5: Lecture 6: Layout, Rounding, Making Decisions OMP 111 · Lecture 6: Layout, Rounding, Making Decisions Lecture Goals: • More spreadsheet layout • More cell format • Rounding

© Lincoln University 2017

A Quick Question

- 5 -

The formula = Sum(C2:C4) is entered in cell C5.

The answer is shown as 4. Why is it not 4.25?

A. The wrong formula is entered in C5

B. The value in C5 has been rounded

C. The decimal places displayed in C5 have been decreased to 0

D. The value in C1 (Num1) has been included

Page 6: Lecture 6: Layout, Rounding, Making Decisions OMP 111 · Lecture 6: Layout, Rounding, Making Decisions Lecture Goals: • More spreadsheet layout • More cell format • Rounding

© Lincoln University 2017

Rounding Display versus rounding Value

- 6 -

Changing the formatting of a cell will change the display only (not the value)

• Decreasing the decimal display of 3.6 (to 0 d.p.) will display as 4 – BUT calculations will use 3.6

To round the actual value of a cell you need to use a function.

Excel has several rounding type functions

• =Round()

• =Roundup()

• =Rounddown()

• …and others

Page 7: Lecture 6: Layout, Rounding, Making Decisions OMP 111 · Lecture 6: Layout, Rounding, Making Decisions Lecture Goals: • More spreadsheet layout • More cell format • Rounding

© Lincoln University 2017

Round function – 1

- 7 -

Excel has several rules for the Round() function.

Round() takes the form: =Round(number, num_digits)

Normally the number to the right of the rounding digit determines whether the rounding digit will be rounded up or down:

• If the value of the number to the right of the rounding digit is less than five, the rounding digit is left unchanged

• If the value of the number to the right of the rounding digit is five or higher, the rounding digit is raised by one

The examples in the top row, below, are rounded (in bottom row) to one decimal place:

Page 8: Lecture 6: Layout, Rounding, Making Decisions OMP 111 · Lecture 6: Layout, Rounding, Making Decisions Lecture Goals: • More spreadsheet layout • More cell format • Rounding

© Lincoln University 2017

Round function – 2

- 8 -

The examples below are rounded to zero decimal places (ie, to whole numbers):

=Round(number, 0) will round up for values with d.p value >=0.5 and down for d.p value <0.5

Page 9: Lecture 6: Layout, Rounding, Making Decisions OMP 111 · Lecture 6: Layout, Rounding, Making Decisions Lecture Goals: • More spreadsheet layout • More cell format • Rounding

© Lincoln University 2017

RoundUp() and RoundDown()

- 9 -

=ROUNDUP() – rounds UP to the nearest value.

• E.g.=ROUNDUP(3.32, 0) will return 4 and =ROUNDUP(3.32, 1) will return 3.4

=ROUNDDOWN() rounds DOWN to the nearest value.

• E.g. =ROUNDDOWN(3.32, 0) will return 3 and =ROUNDDOWN(3.32, 1) will return 3.3

Page 10: Lecture 6: Layout, Rounding, Making Decisions OMP 111 · Lecture 6: Layout, Rounding, Making Decisions Lecture Goals: • More spreadsheet layout • More cell format • Rounding

© Lincoln University 2017

Functions that deal with conditions

- 10 -

Sometimes it is necessary for a formula to return results dependent on whether a condition is true or false.

The IF() function is very useful for this. The IF() takes the form:

=IF( Logical_test, Value_if_true, Value_if_false )

1. Logical_test: the condition you want to check

2. Value_if _true: The return value is condition IS true

3. Value_if_false: the return value if condition is NOT true

1 2 3

Page 11: Lecture 6: Layout, Rounding, Making Decisions OMP 111 · Lecture 6: Layout, Rounding, Making Decisions Lecture Goals: • More spreadsheet layout • More cell format • Rounding

© Lincoln University 2017

IF: a simple example

- 11 -

Page 12: Lecture 6: Layout, Rounding, Making Decisions OMP 111 · Lecture 6: Layout, Rounding, Making Decisions Lecture Goals: • More spreadsheet layout • More cell format • Rounding

© Lincoln University 2017

A Decision Tree

- 12 -

Some times and easy way to look at and make decisions about this type of formula is to draw a decision tree.

Is value in A2 greater than value

in B2?

Return YES in cell C2

Return NO in cell C2NO

YES

Page 13: Lecture 6: Layout, Rounding, Making Decisions OMP 111 · Lecture 6: Layout, Rounding, Making Decisions Lecture Goals: • More spreadsheet layout • More cell format • Rounding

© Lincoln University 2017

Lecture round up

- 13 -

• Good layout will improve spreadsheet efficiency.

• The display of cell values can be rounded to display a different number of decimal places than the original value.

• Rounding functions can be used to change cell value not just display.

• IF function can be used for situations where return values are different for true/false conditions.

• Drawing a decision tree can help in organising an IF function.