- •Оглавление
- •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 round numbers
Often when we work with numbers, we might want whole numbers, completely without decimals. Or we might want decimals, but no more than two. Etc., etc. But what do we do when we have a result calculation that looks like this? =13/3 which gives 4,3333333333333... as a result? Yup, you guessed it, we use the formula =ROUND() This is one of the easier formulas, so you can lower you shoulders now :-) The syntax is as follows: =ROUND([any number];[number of digits]) [any number] This is the number you want to round This can be either a:
number (e.g. [2,3333])
calculation (e.g. [13/4])
cell reference (e.g. [A1])
another formula (e.g. [=SUM(A1:C8)]
[number of digits] This part describes how much you want to round it, where a positive number tells how many digits you want, while a negative number tells how many places to the left of the decimals you want to round. Here are some examples:
=ROUND(23,4445;2) = 23,44
=ROUND(23,4445;0) = 23,00
=ROUND(23,4445;-1) = 20,00
=ROUND(23,4445;3) = 23,445
=ROUND(1223,4445;-3) = 1000,00
=ROUND(1223,4445;-4) = 0,00
OK, now we'll try another usefull one... Remember the use of =RAND() when creating random ages? Now we'll turn it up a notch... Do you also remember how this formula created a decimal number?
=RAND()*(100-18)+18
Normally that's not what we use when referring to the age of a person, so now we'll simply round it:
=ROUND(RAND()*(100-18)+18;0) will create a random age between 18 and 100, rounded to whole years!
Please notice that when we insert a formula inside a formula, there's no need for [=] in front of the formula residing inside, in this case [RAND]. If you follow the color coding above, you'll se that the entire random formula has become the first argument of the =ROUND() formula.
=TRUNC()
How to cut off decimals in an elegant way
=TRUNC() is a formula which is very similar to =ROUND(), and does essentially the same thing, except for one thing; it doesn't round anything, it cuts the decimals off where you tell it to. It's also similar to =ROUND() in that it's a very simple formula to learn :-) The syntax is as follows: =TRUNC([number, cell etc.];[number of decimals to keep]) This way the formula takes any number, and cuts off all decimals to the right of the number of decimals specified. [number, cell etc.] In this area you can insert any number, formula, cell reference or calculation, such as:
[2333/15]
[$B$5]
[sum(A3:C38)]
[58,3333]
All of these are valid. [number of decimals to keep] This are describes how many decimals you want, as long as you use positive numbers. If you use negative numbers, you instruct how many places to the left of the comma you want to erase. Here are som excamples:
=TRUNC(2333,6678;3) => 2333,667
=TRUNC(2333,6678;1) => 2333,60
=TRUNC(2333,6678;-3) => 2000,00
=TRUNC(2333,6678;-1) => 2330,00
As you can see, nothing gets rounded here, it simply cut of the numbers.
=SUMIF()