Go to the Format menu, and select Cells, Number, Custom.. Go to the Format menu, and select Cells, Number, Custom.. Select cell E2 and insert the formula =A2*B2*C2 to calcu-late the tot
Trang 1Convert liters to barrels, gallons, quarts,
and pints
In a worksheet, data is input as liters To convert the value to ferent scales, use the following formulas
dif-4 To convert liters to barrels, gallons, quarts, and pints:
1 Select cell B1 and enter 150.
2 Select cell B3 and type the formula =$B$1/158.98722 to
Trang 2Convert from Fahrenheit to Celsius
To convert temperatures from Fahrenheit to Celsius, you can use
the formula =(Fahrenheit–32)*5/9, or you can use the calculation
described here
4 To convert from Fahrenheit to Celsius:
1 In a worksheet, enter a few temperatures in Fahrenheit incolumn A
2 Select cells B2:B14 and type the following formula:
=(A2*1.8)+32.
3 Press <Ctrl+Enter>.
Note: You can create a user-defined format to insert the
degree sign (°) Go to the Format menu, and select Cells,
Number, Custom In the Type box, select General and press
OK Select a cell, hold down the <Alt> key, type 0176 on the
numeric keypad, then release <Alt> and type either “F” or
Figure 1-24
Trang 3Convert from Celsius to Fahrenheit
To convert temperatures from Celsius to Fahrenheit, you can usethe formula = (Celsius *9/5)+32, or you can use the calculationdescribed here
4 To convert from Celsius to Fahrenheit:
1 In a worksheet, enter a few temperatures in Celsius in umn A
col-2 Select cells B2:B14 and type the following formula:
=(A2-32)/1.8.
3 Press <Ctrl+Enter>.
Note: You can create a user-defined format to insert the
degree sign (°) Go to the Format menu, and select Cells,
Number, Custom In the Type box, select General and press
OK Select a cell, hold down the <Alt> key, type 0176 on the
numeric keypad, then release <Alt> and type either “F” or
“C” without the quotes.
Figure 1-25
Trang 4Calculation with percentage
Let’s say you want to buy a new car The listed price of the car is
$25,500, and the tax to be added is 8% After negotiating a sales
discount of 10%, the final price has to be calculated
4 To calculate the final price:
1 Select cell B1 and enter 25500.
2 Select cell B2 to enter the tax rate of 8%.
3 Select cell B3 and enter the discount rate of 10%.
4 Select cell B5 and type the following formula:
=B1*(1+B2)*(1-B3).
Note: As you see in cell C5 in Figure 1-26, the formula
=B1*(1–B3)*(1+B2) also works The order of multiplication
does not matter.
Figure 1-26
Trang 5Monitor the daily production plan
A worksheet is used to monitor daily production The target isdefined as 1,500 pieces per day To calculate the percentage pro-duced of the daily goal, perform the following steps
4 To monitor daily production:
1 Select cell B1 and enter the predefined target: 1500.
2 Select cells C4:C11 and type the following formula:
=B4/$B$1.
3 Press <Ctrl+Enter>.
4 From the Format menu, select Cells and the Number tab.
5 Choose Percentage from Category.
6 Set Decimal places to 2.
7 Click OK.
Figure 1-27
Trang 6Calculate number of hours between two dates
Excel has a problem calculating the difference between two dates inhours Try this by opening a new worksheet and typing the startingdate including time (3/20/2006 13:42) in cell A2 In cell B2, type theend date and time (3/24/2006 7:42) Then subtract B2 from A2 in
cell C2 The calculation generates 1/3/1900 18:00, which is
incor-rect If your result displays #####, you’ll need to extend the
3 Select Custom from Category.
4 Type the custom format [hh]:mm.
5 Click OK This gives the correct answer.
Figure 1-28
Trang 7Determine the price per pound
A worksheet lists food products in column A Column B shows thecorresponding weight in pounds, and column C contains the totalprice What is the price per pound?
4 To calculate the price per pound:
1 In a workshop, enter the data shown in Figure 1-30, or useyour own data
Trang 8Determine how many pieces to put in a box
Let’s say a container can hold 10 boxes and each box can hold up to
300 items The customer requires a total of 500 items How manyitems must be packed in each box, given a number of boxes?
4 To determine the number of pieces in each box:
1 Select cell A2 and enter 10.
2 Select cell B2 and enter 50.
3 Select cell D2 and type =B2*A2.
4 In cells A4:A7 enter the number of boxes from 2 to 9
5 Select cells B4:B7 and type the following formula:
=$B$2*($A$2/A4).
6 Press <Ctrl+Enter>.
7 Select cells D4:D7 and type the formula =B4*A4.
8 Press <Ctrl+Enter>.
Note: Some entries in column A may result in a number
with a decimal point in column B These will require
additional calculation on your part to determine exactly how
many pieces fit in the given number of boxes so that the
Figure 1-31
Trang 9Calculate manpower required for a project
The number of employees needed for a project has to be calculated
To do this, enter the available time (14 days) for the project in cellA2 Cell B2 contains the number of working hours per day (8.5).Cell C2 shows the current number of employees Now we can cal-culate how many employees are needed to reduce the projectduration or change the number of daily working hours of the
employees
4 To calculate the desired number of employees:
1 Enter different combinations of desired days in column Aand daily working hours in column B
2 Select cell E2 and insert the formula =A2*B2*C2 to
calcu-late the total working hours of the project
3 Select cells C4:C9 and type the following formula:
Trang 10Distribute sales
In a company each sale is assigned to a particular salesperson Thesale of 30 pieces totals $199,000 Each salesperson sold an individ-ual amount of goods Calculate the corresponding sales for each
person
4 To calculate the total amount of sales for each employee:
1 Select cell B1 and enter the total amount of sales: 199000.
2 Select cell C1 and enter the total amount of sold goods: 30.
3 In columns A and B, enter the names of the salespeople andthe number of pieces they sold
4 Select cells C5:C11 and type the following formula:
Trang 11Calculate your net income
People often talk about their gross income To calculate net income,
it is necessary to consider the tax percentage using the followingcalculation
4 To calculate net income:
1 Select cell B1 and enter the tax as a percentage: 33%.
2 In cell B2, enter the gross income: $3500.
3 Select cell B3 and type the formula =B2*B1 to calculate
the tax amount
4 Determine the net income in cell B4 with the formula
=B2-B3.
Note: The amounts in cells B1 and B2 can be changed.
Figure 1-34
Trang 12Calculate percentage of price reduction
A digital camera is on sale The camera’s original price is $250, but
it is now available for $131 What is the percentage of the
reduction?
4 To calculate the price reduction as a percentage:
1 Select cell B2 and enter the original price: $250.
2 In cell B3, enter the sales price: $131.
3 Calculate the absolute difference in cell B4 with the formula
=B2-B3.
4 Determine the percentage of price reduction in cell B5
using the following formula: =B4/B2.
5 From the Format menu, select Cells.
6 Select the Number tab and click the category Percentage.
7 Click OK.
Figure 1-35
Trang 13Dividing and doubling every three hours
In an experiment bacteria divides and doubles every three hours.How many bacteria will there be at the end of one day (24 hours)?
4 To calculate the total amount of bacteria after 24 hours:
1 Enter values from 1 to 4 in cells B2:B8
2 Select cells C2:C8 and type the following formula:
=A2^(24/B2).
3 Press <Ctrl+Enter>.
4 From the Format menu, select Cells and the Number tab.
5 Choose Number from Category.
6 Set Decimal places to 0, and click on the Use 1000
Seperator check box.
7 Click OK.
Note: To insert the ^ character, press the <^> key on the
keyboard followed by a <Space>.
Figure 1-36
Trang 14Calculate the average speed
In this example, someone travels from New York to Los Angeles
with an average speed of 90 miles per hour On the way back, the
average speed is 75 miles per hour What is the overall average
speed?
To calculate the average speed, the speed in each direction has
to be taken into consideration
4 To calculate the overall average speed:
Trang 15This page intentionally left blank.
Trang 16Chapter 2
Logical Functions
Trang 17Use the AND function to compare two columns
Two columns in a worksheet have to be evaluated If the value incolumn A is greater than 20 and the value in column B is greaterthan 25, both values are valid
4 To compare two columns:
1 In cells A2:A10, enter values from 1 to 100
2 In cells B2:B10, enter values from 1 to 100
3 Select cells C2:C10 and type the following formula:
=AND(A2>20,B2>25).
4 Press <Ctrl+Enter>.
Note: If both criteria are valid, Excel shows the value as
TRUE; otherwise it is FALSE.
Figure 2-1
Trang 18Use the AND function to show sales for a
specific period of time
This example checks all rows for a specific time period using the
AND function The function returns TRUE if the arguments are
TRUE and FALSE if one or more arguments are FALSE
Note: Up to 30 conditions can be used in one formula.
4 To show sales in a period of time:
1 Select cell B1 and enter the start date
2 Select cell B2 and enter the end date
3 The range A5:A16 contains dates from 09/13/04 to
09/21/04
4 The range B5:B16 contains sales amounts
5 Select cells C5:C16 and type the following formula:
=AND(A5>=$B$1,A5<=$B$2).
6 Press <Ctrl+Enter>.
Trang 19Use the OR function to check cells for text
A worksheet contains several words in column A Each row has to
be checked for the words “new” or “actual” in column A The ORfunction is used for this task The function returns TRUE if eitherargument is true and FALSE if the arguments are not true
Note: Up to 30 conditions can be used in one formula.
4 To use the OR function to check for two or more criteria:
1 Enter in range A2:A11 words like “new,” “actual,” and
Trang 20Use the OR function to check cells for numbers
A worksheet contains several values in column A Each row has to
be evaluated based on certain criteria in column A The OR
func-tion is used for this task The funcfunc-tion returns TRUE if any
argument is TRUE and FALSE if all arguments are FALSE
Note: Up to 30 conditions can be used in one formula.
4 To check for two or more criteria:
1 Enter in range A2:A12 values from –43 to 100
2 Select cells B2:B12 and type the following formula:
=OR(A2=1,A2>=99,A2<0).
3 Press <Ctrl+Enter>.
Figure 2-4
Trang 21Use the IF function to compare columns and return a specific result
As shown in earlier examples, Excel returns the value TRUE orFALSE when using the OR and AND functions The IF function canalso be used to conduct conditional tests on values and formulas.This example compares two columns and shows the result incolumn C
4 To return specific text after comparing values:
1 Enter in range A2:A12 values from 1 to 1000
2 Enter in range B2:B12 values from 1 to 1000
3 Select cells C2:C12 and type the following formula:
=IF(A2>=B2,"Column A is greater or equal","Column
B is greater").
4 Press <Ctrl+Enter>.
Figure 2-5
Trang 22Use the IF function to check for larger,
equivalent, or smaller values
In the previous example, two different messages were used as theresult for comparing values To check for three conditions in
column A and present the result as “Column A is larger,” “equal,”
or “Column A is smaller,” perform the following steps
4 To compare columns and show the result:
1 Copy the previous example
2 Select cells C2:C12 and type the following formula:
=IF(A2>B2,"Column A is larger",IF(A2=B2,"equal",
"Column A is smaller")).
3 Press <Ctrl+Enter>.
Note: Up to seven IF functions can be combined in one cell.
To combine more than seven functions, use the customized
solution near the end of this chapter.
Figure 2-6
Trang 23Combine IF with AND to check several
conditions
In this example, Excel evaluates which condition meets the criteriaand returns the result in the same row
4 To combine the IF and AND functions:
1 Copy the content of cells C2 to C5 in Figure 2-7 to yourExcel table
2 Frame the table as shown in the screenshot
3 Select cell A2 and enter any kind of sales value, e.g., 120
4 In cell B2, type the following formula:
=IF(AND($A$2<=100,$A$2""),"Sales value is","").
5 In cell B3, type the following formula: =IF(AND
($A$2>100,$A$2<=150)," Sales value is ","").
6 In cell B4, type the following formula: =IF(AND
($A$2>150,$A$2<=200)," Sales value is ","").
7 In cell B5, type the following formula: =IF($A$2>200," Sales value is ","").
Figure 2-7
Trang 24Use the IF function to determine the quarter
of a year
After entering an initial value, Excel can automatically fill
worksheet cells with the names of weekdays or months Open a
new worksheet and type the word “January” in cell A2 Then dragthe lower-right point of this cell down to A13 to let Excel create alist containing the months of the year In this example, we want toindicate which months fall into which quarter
4 To determine the quarter of a year in which a particular
month falls:
1 Select cells B2:B13 and type the following formula:
=IF(OR(A2="January",A2="February",A2="March"),
"1st quarter",IF(OR(A2="April",A2="May", A2="June"),"2nd quarter",IF(OR(A2="July",A2=
"August",A2="September"),"3rd quarter","4th quarter"))).
2 Press <Ctrl+Enter>.
Figure 2-8
Trang 25Use the IF function to check cells in
worksheets and workbooks
To use an IF statement not only in a worksheet but also in a linkedworksheet or workbook, start typing part of the formula, for exam-ple, “ =IF(,” then navigate to another worksheet or open up aworkbook, select the desired cell, and go back to the first
worksheet to finish the formula
4 To use the IF function to check out cells in another
worksheet:
Type =IF(Sheet8!A2"january","wrong month","OK").
4 To use the IF function to check out cells in another
Trang 26Use the IF function to calculate with
different tax rates
If two or more different tax rates have to be handled, you can use
the IF function to calculate each one individually Simply combine
several IF functions, depending on the calculation
4 To calculate the price after tax:
1 In column A, enter some prices
2 In column B, enter different tax percentages (0, 8, or 10 forthis example)
3 Select cells C2:C10 and type the following formula: =IF
Trang 27Use the IF function to calculate the
commissions for individual sales
A company has a policy for individual commissions depending onsales, as shown below:
Sale => $100 and < $500 5%
4 To calculate the commissions:
1 Enter different possible sales amounts in column A
2 Select cells B2:B12 and type the following formula:
=A2*IF(A2>=500,0.08,IF(A2>=100,0.05,0.03)).
3 Press <Ctrl+Enter>.
Figure 2-11
Trang 28Use the IF function to compare two cells
The following tip is a solution for comparing two cells line by line.Prepare a new worksheet, filling the first two columns with the
values 0 and 1 as shown in Figure 2-12
4 To compare cells line by line:
1 Select cells C2:C11 and type the following formula: