MG1016 Seminar Excel Basic1
MG1016 Seminar Excel Basic1
1. The dollar signs are relevant only for the purpose of copying or moving; they
have no inherent effect on the formula itself. For example, the formulas =5*B3
and =5*$B$3 in some cell produce exactly the same result. Their difference is
relevant only if you want to copy the formula to some range.
2. There is never any need to type the dollar signs. You can do it with the F4 key.
This is explained in more detail below.
Enter a cell reference such as =B3 in a formula. Then press the F4 key.
In fact, if you press the F4 key repeatedly, you cycle through the possibilities: B3
(neither row nor column fixed), then $B$3 (both column B and row 3 fixed), then
B$3 (only row 3 fixed), then $B3 (only column B fixed), and back again to B3.
Try it! Enter the appropriate formula in cell L35 and copy across to O35. (Scroll to
the right to see the answer.)
Try it again! Enter one formula with appropriate absolute/relative addressing in cell
M41 that can be copied to M41:P45. (Scroll to the right to see the answer.)
Fixed cost $50
Variable cost $2
Units sold
50 100 150 200
Unit price $3.25
$3.50
$3.75
$4.00
$4.25
Fixed cost $50
Variable cost $2
Units sold
50 100 150 200
Unit price $3.25 $162.50 $325.00 $487.50 $650.00
$3.50 $175.00 $350.00 $525.00 $700.00
$3.75 $187.50 $375.00 $562.50 $750.00
$4.00 $200.00 $400.00 $600.00 $800.00
$4.25 $212.50 $425.00 $637.50 $850.00
© S. Christian Albright, 2011-2023, All Rights Reserved Return to List of Topics sheet
The SUM function is used so often to sum across rows or columns that a button
(the S button) is available to automate the procedure. This button is on the Home
ribbon and the Formulas ribbon, as shown to the right.
To illustrate its use, suppose you have a table of numbers in some rectangular
range. You want row sums to appear to the right of the range, and you want
column sums to appear below the range. This is easy.
Select the range(s) where you want the sums to appear and click the AutoSum
button.
Note that if you select multiple cells, you get the sums automatically. If you select
a single cell, such as when you have a single column of numbers to sum, you are
shown the sum formula “for your approval,” and you have to press Enter to
actually enter it.
Try it! Use the AutoSum button to fill in the row and column sums in the gray cells
to the right, including the darker gray cell which should show the sum of all the
data.
51 94 15 7
37 6 2 41
13 83 29 88
73 64 46 32
38 11 3 80
The SUM function is probably the most used Excel function of all. It sums all
values in one or more ranges.
Enter the formula =SUM(range), where range is any range. This sums the
numeric values in the range. If there are any nonnumeric or blank cells in this
range, they are ignored.
Here is a shortcut, which works for any function that takes multiple ranges,
separated by commas. Hold the Ctrl key and then drag the ranges, one after the
other. The commas will be entered for you automatically.
Try it! Use the SUM function in the above gray cell to calculate the total of all
costs. (Scroll to the right for the answer.)
Enter the formula =AVERAGE(range) where range is any range. This produces the
average of the numeric values in the range.
Note that the AVERAGE function ignores labels and blank cells. So, for example, if
the range C3:C50 includes scores for students on an exam, but cells C6 and C32 are
blank because these students haven’t yet taken the exam, then =AVERAGE(C3:C50)
averages only the scores for the students who took the exam. (It does not
automatically average in 0s for the two who didn’t take the exam.)
Try it! Use the AVERAGE function in the two gray cells to the right to calculate the
averages indicated. (For the formula in the lower gray cell, replicate the exam
scores in column M and make some changes. Scroll to the right for the answers.)
Try it! Use the AVERAGE function in the two gray cells to the right to calculate the
averages indicated. (For the formula in the lower gray cell, replicate the exam
scores in column M and make some changes. Scroll to the right for the answers.)
You certainly know the SUM function for summing, but you might not be aware that
there is a PRODUCT function for multiplying. It works exactly like the SUM function,
that is, all of its arguments are multiplied together. Any blank or text cells are ignored
in the product. Specifically, they are not treated as 0s.
Try it! Find the product of the first six exam scores to the right, including the Absent
value. Then delete the Absent value, that is, make its cell blank. Does this change the
product?
st of Topics sheet
Total cost
Student ID Exam score Average (only for students who took the exam)
1533 68
8031 74
9859 80 Average (giving 0s to students who were absent)
9106 63
3535 72
8192 Absent
6102 85
6774 70
7558 64
314 72
9082 81
2397 75
2517 80
2432 73
6016 63
5269 80
4847 88
6537 71
9922 73
4525 71
1491 71
7897 68 Product
4088 82
166 76
7925 75
6405 81
802 76
2931 83
7625 67
2628 67
5417 92
7804 72
3994 69
394 85
8847 78
7855 81
8668 Absent
3738 77
5534 70
6965 71
8863 69
8762 73
6466 60
6100 76
1878 74
5970 67
9691 62
8666 77
4865 91
6198 81
8554 87
6753 76
9574 77
3891 81
8186 Absent
1306 73
6835 83
3136 59
4938 74
4807 74
4421 78
Total cost $47,500
Student ID Exam score With 0s Average (only for students who took the exa
1533 68 68 74.75862069
8031 74 74
9859 80 80 Average (giving 0s to students who were abs
9106 63 63 71.08196721
3535 72 72
8192 Absent 0
6102 85 85
6774 70 70
7558 64 64
314 72 72
9082 81 81
2397 75 75
2517 80 80
2432 73 73
6016 63 63
5269 80 80
4847 88 88
6537 71 71
9922 73 73
4525 71 71
1491 71 71
7897 68 68 Product
4088 82 82 1826012160
166 76 76
7925 75 75
6405 81 81
802 76 76
2931 83 83
7625 67 67
2628 67 67
5417 92 92
7804 72 72
3994 69 69
394 85 85
8847 78 78
7855 81 81
8668 Absent 0
3738 77 77
5534 70 70
6965 71 71
8863 69 69
8762 73 73
6466 60 60
6100 76 76
1878 74 74
5970 67 67
9691 62 62
8666 77 77
4865 91 91
6198 81 81
8554 87 87
6753 76 76
9574 77 77
3891 81 81
8186 Absent 0
1306 73 73
6835 83 83
3136 59 59
4938 74 74
4807 74 74
4421 78 78
nts who took the exam)
IF functions are very useful for performing logic, and they vary from simple to
complex. A few typical examples are illustrated here.
Try it! Enter appropriate IF formulas in columns M and N. (Scroll to the right for
answers.)
Nested IF Functions
Sometimes IF functions are nested. For example, there might be three possibilities,
depending on whether the value in cell A1 is negative, zero, or positive. A nested IF
formula can then be used as follows.
Note the syntax. The keyword AND is followed by the conditions, separated by a
comma and enclosed within parentheses. Also, note that any number of
conditions, not just two, can be included in the AND, all separated by commas.
Try it! Use an IF function with an AND condition to fill in the gray range for selling
to the right. Make sure you use double quotes for text. (Scroll to the right for
answers.)
Again, any number of conditions, not just two, can be included in the OR.
Try it! Use an IF function with an OR condition to fill in the bonuses in column P.
(Scroll to the right for answers.)
You can even have AND and OR conditions in the same formula. A typical
example is =IF(OR(AND(B3>=10,C3>=15),D3<50),1000,2000). For example, if
cells B3, C3, and D3 have values 12, 10, and 40, this returns 1000 because the
second condition (D3<50) is true, even though the AND condition is false.
The key to writing (and reading) such complex formulas is to pay careful
attention to the parentheses. Fortunately, Excel helps you by color-coding pairs
of parentheses. From now on, pay close attention to this color coding. You will
come to depend on it!
st of Topics sheet
For each product, if the end inventory is less than or equal to 50 units,
enough units are ordered to bring stock back up to 200; otherwise, no
units of that product are ordered
Each student gets an A (if score is 90 or above), S for satisfactory (if score
is 60 or above but less than 90) or U for unsatisfactory if score is below 60
Any student who scores at least 95 on any of the exams gets a bonus
which is 1% of their total score.
Grade
S
A
U
S
S
A
Sell?
No
No
Yes
No
Bonus
0
3.2
3.29
3.53
0
0
© S. Christian Albright, 2011-2023, All Rights Reserved Return to List of Topics sheet
The COUNT function counts all of the cells in a range with numeric values. The
COUNTA function counts all nonblank cells in a range. For example, if cells A1,
A2, and A3 contain Month, 1, and 2, respectively, then =COUNT(A1:A3) returns
2, whereas =COUNTA(A1:A3) returns 3.
Enter the formula =COUNT(range), where range is any range. This returns the
number of numeric values in the range.
Enter the formula =COUNTA(range), where range is any range. This returns the
number of nonblank cells in the range.
Enter the formula =COUNTBLANK(range), where range is any range. This returns
the number of blank cells in the range.
Try it! Use the COUNT, COUNTA, and COUNTBLANK functions to fill in the gray
cells to the right. (Scroll to the right for the answers.)
Note: Excel uses somewhat different terms on the status bar. If you select a
range and right-click the status bar, you will see the two options "Count" and
"Numerical Count." The first corresponds to the COUNTA function, and the
second corresponds to the COUNT function.
st of Topics sheet
There are several Excel functions that allow you to count values, or sum or average
values, subject to conditions. Until Excel 2007, this was possible only for a single
condition, such as all people younger than 35 years old, and there were only two
functions available, COUNTIF and SUMIF. In response to customer demand, Microsoft
added four new functions in Excel 2007: AVERAGEIF (for a single condition), and
COUNTIFS, SUMIFS, and AVERAGEIFS (for multiple conditions). These are all handy
functions, and you should learn how to use them.
The COUNTIF function counts all values in a specified range that satisfy a certain
condition.
The criterion can be tricky to specify. If you want a specific value, such as Male,
you can specify it as "Male" (double quotes required), or you can use a cell
reference such as Q8. Also, if you want a specific inequality, such as younger than
20, you can specify it literally as "<20" (again, double quotes required). But if you
want it to be younger than the value in cell Q9, you need to piece it together as a
literal part, "<", and a variable part, whatever is in cell Q9. The correct syntax is
"<"&Q9. The ampersand (&) symbol concatenates (pieces together) the two
parts. For example, if you want to count the number of students who are older
than then the value in cell Q9, the correct formula is
=COUNTIF(M9:M80,">"&Q9).
Try it! Use COUNTIF in the top gray cell to the right to find the number of
students who scored at least as high as the value in cell Q10. (Scroll to the right
for the answer.)
The SUMIF function sums values in one range where a condition in a corresponding
range is satisfied. Usually, the setup is like the example to the right, where you want
to sum or average scores in one column (N), but only for rows that satisfy a
condition in another column (L or M).
The SUMIF function sums values in one range where a condition in a corresponding
range is satisfied. Usually, the setup is like the example to the right, where you want
to sum or average scores in one column (N), but only for rows that satisfy a
condition in another column (L or M).
Try it! Calculate the sums indicated in rows 14-16 to the right. (Scroll to the right for
the answers.)
The AVERAGEIF function works just like the SUMIF function, except that it averages the
values in the last argument range, the average_range.
Try it! Calculate the averages indicated in rows 18-20 to the right. (Scroll to the right for
the answers.)
st of Topics sheet
# of "high" scores
The "plural" functions discussed here, COUNTIFS, SUMIFS, and AVERAGEIFS, were added in Excel 2007.
They allow you to impose multiple conditions, such as male and younger than some value. Their
arguments, described in more detail below, include any number of pairs of criterion ranges and
criteria, such as L9:L80,"Male".
The COUNTIFS function counts the number of rows that satisfy all of the conditions.
Try it! In the top gray cell to the right, find the number of students with the gender in cell Q8 and
age younger than the age cutoff in cell Q9 who scored less than or equal to the score cutoff in cell
Q10. (Scroll to the right for the answer.)
The SUMIFS function is similar in concept to SUMIF, but its syntax is different. (Microsoft chose
this syntax instead of the original SUMIF syntax for logical reasons, but they didn't want to change
the SUMIF syntax because it would have broken too many existing spreadsheets.) Now the range
to sum comes first, and the criteria ranges and criteria come last.
=SUMIFS(sum_range,criterion_range1,criterion1,criterion_range2,criterion2,...)
Again, the setup is typically like the example to the right. There is a column such as exam score to
sum. The criteria impose conditions on other columns, or even the same column. Only those rows
that meet all of the conditions are part of the sum.
Try it! In the middle gray cell to the right, calculate the total of all scores made by the gender in
cell Q8 and ages younger than the age cutoff in cell Q9. (Scroll to the right for the answer.)
cell Q8 and ages younger than the age cutoff in cell Q9. (Scroll to the right for the answer.)
The AVERAGEIFS function works just like the SUMIFS function, except that it averages the values in the
the average_range argument.
Try it! Calculate the average in the bottom gray cell to the right, using the same criteria as in the
SUMIFS exercise above. (Scroll to the right for the answer.)
eturn to List of Topics sheet
el 2007.
ir
d
There are many times when you need to sum products of values in two (or
possibly more than two) same-size ranges. Fortunately, there is a SUMPRODUCT
function that sums products quickly.
There can actually be more than two ranges in the SUMPRODUCT formula,
separated by commas, as long as all of them have exactly the same size. This is
not as common as having only two ranges, but it is sometimes useful.
Try it! Sum the products of the two ranges in the example to the right to find the
total shipping cost in the gray cell. (Scroll to the right for the answer.)
By the way, if you are tempted to write the formula without the SUMPRODUCT
function as the sum of nine products, as many beginning users tend to do,
imagine how long your formula would be if there were 10 plants and 50 cities!
The SUMPRODUCT function is extremely efficient, so get used to using it.
st of Topics sheet
Total cost
Total cost 1609.5