Vous êtes sur la page 1sur 26

Count and Sum Functions

Count | Countif | Countifs | Sum | Sumif | Sumifs

The most used functions in Excel are the functions that count and sum. You can count and sum based on
onecriteria or multiple criteria.

Count
To count the number of cells that contain numbers, use the COUNT function.

Advertisement

Countif
To count cells based on one criteria (for example, higher than 9), use the following COUNTIF function.

Countifs
To count cells based on multiple criteria (for example, green and higher than 9), use the following COUNTIFS
function.
Sum
To sum a range of cells, use the SUM function.

Sumif
To sum cells based on one criteria (for example, higher than 9), use the following SUMIF function (two arguments).

To sum cells based on one criteria (for example, green), use the following SUMIF function (three arguments, last
argument is the range to sum).
Sumifs
To sum cells based on multiple criteria (for example, blue and green), use the following SUMIFS function (first
argument is the range to sum).

General note: in a similar way, you can use the AVERAGEIF and AVERAGEIFS function to average cells based on
one or multiple criteria.
Logical Functions
If Function | And Function | Or Function

Learn how to use Excel's logical functions such as the IF, AND and OR function.

If Function
The IF function checks whether a condition is met, and returns one value if TRUE and another value if FALSE.

1. Select cell C2 and enter the following function.

Advertisement

The IF function returns Correct because the value in cell A1 is higher than 10.

And Function
The AND Function returns TRUE if all conditions are true and returns FALSE if any of the conditions are false.

1. Select cell D2 and enter the following formula.

The AND function returns FALSE because the value in cell B2 is not higher than 5. As a result the IF function returns
Incorrect.

Or Function
The OR function returns TRUE if any of the conditions are TRUE and returns FALSE if all conditions are false.

1. Select cell E2 and enter the following formula.


The OR function returns TRUE because the value in cell A1 is higher than 10. As a result the IF function returns
Correct.
Date & Time Functions
Year, Month, Day | Date Function | Current Date & Time | Hour, Min, Sec | Time Function

To enter a date in Excel, use the "/" or "-" characters. To enter a time, use the ":" (colon). You can also enter a date
and a time in one cell.

Note: Dates are in US Format. Months first, Days second. This type of format depends on your windows regional
settings. Learn more about Date and Time formats.

Advertisement

Year, Month, Day


To get the year of a date, use the YEAR function.

Note: use the MONTH and DAY function to get the month and day of a date.

Date Function
1. To add a number of days to a date, use the following simple formula.

2. To add a number of years, months and/or days, use the DATE function.
Note: the DATE function accepts three arguments: year, month and day. Excel knows that 6 + 2 = 8 = August has 31
days and rolls over to the next month (23 August + 9 days = 1 September).

Current Date & Time


To get the current date and time, use the NOW function.

Note: use the TODAY function to get the current date only. Use NOW()-TODAY() to get the current time only (and
apply a Time format).

Hour, Min, Sec


To return the hour, use the HOUR function.

Note: use the MINUTE and SECOND function to return the minute and second.

Time Function
To add a number of hours, minutes and/or seconds, use the TIME function.
Note: Excel adds 2 hours, 10 + 1 = 11 minutes and 70 - 60 = 10 seconds.
Text Functions
Join Strings | Left | Right | Mid | Len | Find | Substitute

Excel has many functions to offer when it comes to manipulating text strings.

Join Strings
To join strings, use the & operator.

Note: to insert a space, use " "

Advertisement

Left
To extract the leftmost characters from a string, use the LEFT function.

Right
To extract the rightmost characters from a string, use the RIGHT function.

Mid
To extract a substring, starting in the middle of a string, use the MID function.
Note: started at position 5 (p) with length 3.

Len
To get the length of a string, use the LEN function.

Note: space (position 8) included!

Find
To find the position of a substring in a string, use the FIND function.

Note: string "am" found at position 3.

Substitute
To replace existing text with new text in a string, use the SUBSTITUTE function.
Lookup & Reference Functions
VLookup | HLookup | Match | Index | Choose

Learn all about Excel's lookup & reference functions such as the VLOOKUP, HLOOKUP, MATCH, INDEX and
CHOOSE function.

VLookup
The VLOOKUP (Vertical lookup) function looks for a value in the leftmost column of a table, and then returns a value
in the same row from another column you specify.

1. Insert the VLOOKUP function shown below.

Advertisement

Explanation: the VLOOKUP function looks for the ID (104) in the leftmost column of the range $E$4:$G$7 and returns
the value in the same row from the third column (third argument is set to 3). The fourth argument is set to FALSE to
return an exact match or a #N/A error if not found.

2. Drag the VLOOKUP function in cell B2 down to cell B11.


Note: when we drag the VLOOKUP function down, the absolute reference ($E$4:$G$7) stays the same, while the
relative reference (A2) changes to A3, A4, A5, etc.

HLookup
In a similar way, you can use the HLOOKUP (Horizontal lookup) function.

Match
The MATCH function returns the position of a value in a given range.
Note: Yellow found at position 3 in the range E4:E7. The third argument is optional. Set this argument to 0 to return
the position of the value that is exactly equal to lookup_value (A2) or a #N/A error if not found.

Index
The INDEX function returns a specific value in a two-dimensional or one-dimensional range.

Note: 92 found at the intersection of row 3 and column 2 in the range E4:F7.
Note: 97 found at position 3 in the range E4:E7.

Choose
The CHOOSE function returns a value from a list of values, based on a position number.

Note: Boat found at position 3.


Statistical Functions
Average | Averageif | Median | Mode | Standard Deviation | Min | Max | Large | Small

This chapter gives an overview of some very useful statistical functions in Excel.

Average
To calculate the average of a range of cells, use the AVERAGE function.

Advertisement

Averageif
To average cells based on one criteria, use the AVERAGEIF function. For example, to calculate the average
excluding zeros.

Note: <> means not equal to. The AVERAGEIF function is similar to the SUMIF function.

Median
To find the median (or middle number), use the MEDIAN function.
Check:

Mode
To find the most frequently occurring number, use the MODE function.

Standard Deviation
To calculate the standard deviation, use the STEDV function.

Min
To find the minimum value, use the MIN function.

Max
To find the maximum value, use the MAX function.
Large
To find the third largest number, use the following LARGE function.

Check:

Small
To find the second smallest number, use the following SMALL function.

Check:

Tip: Excel can generate most of these results with the click of a button. Our Descriptive Statistics example shows you
how.
Nested If

The IF function can be nested, when you have multiple conditions to meet. The FALSE value is being replaced by
another If function to make a further test. For example, look at the formula below.

1a. If cell A1 equals 1, the function returns Bad.

Advertisement

1b. If cell A1 equals 2, the function returns Good.

1c. If cell A1 equals 3, the function returns Excellent.

1d. If cell A1 equals another value, the function returns No Valid Score.

Here's another example.


2a. If cell A1 is less or equal to 10, the function returns 350.

2b. If cell A1 is greater than 10 and less or equal to 20, the function returns 700.

2c. If cell A1 is greater than 20 and less or equal to 30, the function returns 1400.

2d. If cell A1 is greater than 30, the function returns 2000.

Note: to slightly change the boundaries, you might want to use "<" instead of "<=" in your own formula.

Advertisement
What-If Analysis
Create Different Scenarios | Scenario Summary | Goal Seek

What-If Analysis in Excel allows you to try out different values (scenarios) for formulas. The following example helps
you master what-if analysis quickly and easily.

Assume you own a book store and have 100 books in storage. You sell a certain % for the highest price of $50 and a
certain % for the lower price of $20.

Advertisement

If you sell 60% for the highest price, cell D10 calculates a total profit of 60 * $50 + 40 * $20 = $3800.

Create Different Scenarios


But what if you sell 70% for the highest price? And what if you sell 80% for the highest price? Or 90%, or even 100%?
Each different percentage is a different scenario. You can use the Scenario Manager to create these scenarios.

Note: You can simply type in a different percentage into cell C4 to see the corresponding result of a scenario in cell
D10. However, what-if analysis enables you to easily compare the results of different scenarios. Read on.

1. On the Data tab, click What-If Analysis and select Scenario Manager from the list.
The Scenario Manager dialog box appears.

2. Add a scenario by clicking on Add.

3. Type a name (60% highest), select cell C4 (% sold for the highest price) for the Changing cells and click on OK.
4. Enter the corresponding value 0.6 and click on OK again.

5. Next, add 4 other scenarios (70%, 80%, 90% and 100%).

Finally, your Scenario Manager should be consistent with the picture below:
Note: to see the result of a scenario, select the scenario and click on the Show button. Excel will change the value of
cell C4 accordingly for you to see the corresponding result on the sheet.

Advertisement

Scenario Summary
To easily compare the results of these scenarios, execute the following steps.

1. Click the Summary button in the Scenario Manager.

2. Next, select cell D10 (total profit) for the result cell and click on OK.

Result:
Conclusion: if you sell 70% for the highest price, you obtain a total profit of $4100, if you sell 80% for the highest
price, you obtain a total profit of $4400, etc. That's how easy what-if analysis in Excel can be.

Goal Seek
What if you want to know how many books you need to sell for the highest price, to obtain a total profit of exactly
$4700? You can use Excel's Goal Seek feature to find the answer.

1. On the Data tab, click What-If Analysis, Goal Seek.

The Goal Seek dialog box appears.

2. Select cell D10.

3. Click in the 'To value' box and type 4700.

4. Click in the 'By changing cell' box and select cell C4.

5. Click OK.
Result. You need to sell 90% of the books for the highest price to obtain a total profit of exactly $4700.

Advertisement
FREQUENTLY ASKED QUESTIONS
Question: In Microsoft Excel, I need to write a formula that works this way:
If (cell A1) is less than 20, then multiply by 1,
If it is greater than or equal to 20 but less than 50, then multiply by 2
If its is greater than or equal to 50 and less than 100, then multiply by 3
And if it is great or equal to than 100, then multiply by 4

Answer: You can write a nested IF statement to handle this. For example:

=IF(A1<20, A1*1, IF(A1<50, A1*2, IF(A1<100, A1*3, A1*4)))

Question:In Excel, I need a formula in cell C5 that does the following:


IF A1+B1 <= 4, return $20
IF A1+B1 > 4 but <= 9, return $35
IF A1+B1 > 9 but <= 14, return $50
IF A1+B1 > 15, return $75

Answer:In cell C5, you can write a nested IF statement that uses the AND function as
follows:

=IF((A1+B1)<=4,20,IF(AND((A1+B1)>4,(A1+B1)<=9),35,IF(AND((A1+B1)>9,(A1+B1)<=14),50,75
)))

Vous aimerez peut-être aussi