- •Оглавление
- •Introduction 2
- •Introducing Ms. Formula 10
- •Introduction Calc is a spread sheet -- what are those?
- •Open Sesame How to open a document
- •Save Me How to open a document
- •Close the Gates How to close a document
- •Introducing Ms. Formula An oversized calculator
- •Our first, real formula...
- •Average Joe The second formula
- •The time is now How to let Calc give you time
- •Extracting a given number of characters from a cells, counting from left
- •Extracting a given number of characters from a cells, counting from right
- •Extracting a given number characters, counting from the point you specify
- •How to create and use random numbers
- •How to look up values in a grid
- •How to round numbers
- •How to cut off decimals in an elegant way
- •How to sum only lines meeting your criteria
- •Vlookup(a1;b1:d100;3;0)
- •Vlookup(a1;b1:d100;3;0)
- •How to count characters in a cell or string
- •Formatting of text and cells How to change the appearance of the spreadsheet easily
- •DataPilot How to manipulate huge amounts of data easily
- •Charts How to create simple charts
How to sum only lines meeting your criteria
=SUMIF() is
one of those really powerful
formulas, and is one that everybody who work with large lists should
really get to know intimately.
With =SUMIF() you
can sum all values in a column as long as the value on the same line
in a different (or the same) column match a criteria you set.
Sounds
complicated? Actually, it isn’t, believe it or not! Please go to
the next step, and I’ll show how to use it.
Imagine
that you have a list with these columns:
Column A: Name
Column B: Product
Column C: Sales
Now,
to sum horisontally and vertically, we can use the excellent
formula =SUM(),
right? Right.
But
it gets a bit more complicated the moment we want to sum only Eddies
sales, doesn’t it? We could of course split sort each column and
create one
list for each person and use =SUM().
It would give you the correct amount, but it would involve a lot of
work, and, in the end, the possibility of for errors will increase.
Imagine the lists change all the time, and contains 10 000
lines...
This
is where =SUMIF() can
be an excellent solution!
What
we’ll do, is to enter any name in a cell, and let Calc sum all
values related to this name.
The syntax is: =SUMIF([Column
to be evaluated];[Criteria];[Column
to sum if criteria is met])
[Column
to be evaluated]
In
our example, this will be column A.
So, in our example, if the name is "Eddie" is found in
column A,
it will be summed, otherwise it will be ignored.
[Criteria]
This
is the criteria to be fulfilled in [Column
to be evaluated].
This can be a formula, a value or a cell reference. In this case, it
refers to cell F3,
where Eddies name is.
[Column
to sum if criteria is met]
If
the criteria in the first column is met, this column is the one to
sum. In our example, that would be the column for Sales,
column C.
Please
note that [Column
to be evaluated] and [Column
to sum if criteria is met] can
actually be the same column! You could for instance specify that all
values greater than 10 in column C should
be summed.
Here’s a nice colorization of the formula
used in our example:
=SUMIF(A1:A11;F3;C1:C11)
You
can now try to change the name between Eddie, Diane and Tor. Also,
try to enter a name that’s not included in the list, just to see
what happens.
This
time we’ll ad the ability to sum by product in the same
manner.
Instead of having the [Column
to be evaluated] to
be column A,
we’ll use column B,
as you can see above.
Try entering Oranges, Apples and
others, and see what happens!
=IF()
How to set conditions for your formulas
=IF() is a formula used for performing something under certain conditions. It might seem like it is quite similar to =SUMIF(), but =IF() is a lot more versatile. In short, you make a statement (any statement that can be either TRUE or FALSE), and have Calcperform one task if it is TRUE, and another task if it is FALSE. The syntax for =IF() is as follows: =IF([Any statement that can be either TRUE or FALSE];[If the statement is TRUE, perform this]; [If the statement is FALSE, perform this]) As you can see, this formula has three parameters, where the first one is a test, and the next two defines what to do if the first parameter is either true or false. We start off with some theory, as usual, before we start typing. Now take a closer look at the first parameter: [Any statement that can be either TRUE or FALSE] This test can be a variety of statements, as long as it can be either TRUE or FALSE. This means that all of these are valid:
2+2=4
A1=12
SUM(A1:C42)
A2=A5*12
TRUE
FALSE
This time look at the second parameter: [If the statement is TRUE, perform this] If the first parameter is TRUE, this parameter will tell Calc what to do next. You can put a value or formula here, such as:
