Top Banner
Here are the 21 signs that you can use to develop Excel formulas. Notice that when you start copy/pasting long formulas (using SUMPRODUCT or INDEX/MATCH ) you will start using the dollar sign ($). Here is a very useful tip: to add $ to addresses (making them relative or absolute) click on the address within the address bar (above the Excel grid) and use the F4 key at the top of your keyboard once, twice, three or four times. Notice that the + and * signs are essential when you start using the most important, useful and powerful function in Excel: SUMPRODUCT Signs What it Does = Equals (all formulas begin with an equal sign.) ( Open parenthesis ) Close parenthesis , Separating arguments : From A1 to A23 A1:A23 + Plus. *** Also: used to submit more than one argument as criteria within a SUMPRODUCT formula. - Minus * Multiplies. *** Also: used to separate arguments in SUMPRODUCT formulas / Divides
41

Understanding Excel

May 10, 2017

Download

Documents

Chika Albert
Welcome message from author
This document is posted to help you gain knowledge. Please leave a comment to let me know what you think about it! Share it to your friends and learn new things together.
Transcript
Page 1: Understanding Excel

Here are the 21  signs that you can use to develop Excel formulas.

Notice that when you start copy/pasting long formulas (using SUMPRODUCT or INDEX/MATCH) you will start using the dollar sign ($). Here is a very useful tip: to add $ to addresses (making them relative or absolute) click on the address within the address bar (above the Excel grid) and use the F4 key at the top of your keyboard once, twice, three or four times.

Notice that the + and * signs are essential  when you start using the most important, useful and powerful function in Excel: SUMPRODUCT

Signs What it Does

= Equals (all formulas begin with an equal sign.)

( Open parenthesis

) Close parenthesis

, Separating arguments

: From A1 to A23   A1:A23

+Plus. *** Also:  used to submit more than one argument as criteria within a SUMPRODUCT formula.

- Minus

* Multiplies.   *** Also:  used to separate arguments in SUMPRODUCT formulas

/ Divides

< Smaller than: used mostly within IF formulas

> Greater than: used mostly within IF formulas

" " What is within the quotes is text

&Working with text, assembling strings (chains of characters), concatenation

Page 2: Understanding Excel

(Space) Separating arguments (Metric system)

$ Absolute/Relative References

^ Returns the result of a number raised to a power

' Transforms any content into text

[Surrounds the name and path of another workbook to wich refers a formula.

]  

{Surrounds and identifies array formulas that are entered with SHIFT/CTRL/ENTER

}Surrounds and identifies array formulas that are entered with SHIFT/CTRL/ENTER

Examples

=A will result in the error message #Name?  because Excel does not know a function by the name of A.

=" A" will result  in A because you are saying with the quotation marks  that you want this cell to carry the character A.

=A1 will result in the value of cell A1 be it a number, a date or a string of character.

=3 will result in the number 3

=A1+A2+A3 will result in the sum of cells A1, A2 and A3. You can also use the SUM function =SUM(A1:A3) the colon meaning from/to.

=10/A1 will result in 10 divided by the value of cell A1. If cell A1 is empty or contains zero you end up with the error message #DIV/0!.

=IF(A1> 90," A" ," B" ) in plain English this formula says if the value of cell A1 is greater than 90 then the value of the cell in which resides this formula should be the letter A otherwise it should be the letter B. Notice the commas separating the three arguments of this IF formula. IF(condition, value if condition is true, value if condition is false)

Page 3: Understanding Excel

=IF(A1< > 100,0,100) in plain English this formula says if the value of cell A1 is different  than 90 then the value of the cell in which resides this formula should be 0  otherwise it should be 100

=IF(A1< =100,0,100)in plain English this formula says if the value of cell A1 is smaller then or equal to 100  then the value of the cell in which resides this formula should be 0  otherwise it should be 100

If in cell A1 you have " Peter" and in cell A2 you have " Clark" the formula =A1 & A2 in A3 will result in " PeterClark" . If you want a space between the first name and surname you will use the formula =A1 & " " & A2telling Excel to insert a space (Space between double quotes) between the values of cell A1 and cell A2.

You must learn to master the use of the dollar sign ($) if you want to start developing long and complex formulas that you would want to copy/paste. To insert $ signs within an address select it in the formula bar and click on the F4 key once, twice, three or four times as needed.

If in cell A1 you have the formula =B6 it will become =B7 when you copy/paste it in cell A2 and it will become =C6 if you copy/paste it in cell B1 because the row and column are relative.

If in cell A1you have the formula =$B$6 you can copy/paste it anywhere, the address does not change because the row and column are absolute.

If in cell A1you have the formula =$B6 it will become =B7 when you copy/paste it in cell A2 and it will remain  =$B6 if you copy/paste it in cell B1 because the row is relative but the column are absolute.

If in cell A1you have the formula =B$6 it will remain  =B$6 when you copy/paste it in cell A2 and it will become  =C$6 if you copy/paste it in cell B1 because the row is absolute  but the column is  relative

Excel Functions and Formulas Sitemap

 

In annex 2 you have found a description of all 21 Excel functions in the "Date and Time" category. Below is the list of the 9 most useful ones.

Functions What it Does

DATE Returns the serial number of a particular date

DATEDIF Calculates the interval in days, months or years between two dates

Page 4: Understanding Excel

DAY Converts a serial number to a day of the month

HOUR Converts a serial number to an hour

MINUTE Converts a serial number to a minute

MONTH Converts a serial number to a month

SECOND Converts a serial number to a second

TIME Returns the serial number of a particular time

TODAY Returns the serial number of today's date

YEAR Converts a serial number to a year

NOW Returns the serial number of the current date and time

WEEKDAY Converts a serial number to a day of the week

The three most important things that you should remember when working with dates and times are:FORMAT, FORMAT and FORMAT.

For example:

If you have the dates 1/16/2005 in cell A1 and 1/22/2005 in cell B1=B1-A1 in cell C1 will return:- 6 if the format of cell C1 is either "General" or "Number" - 1/6/1900 if the format of cell C1 is "Date"

If you have a date in cell A1 and you want the date for the next day in cell B1 (formatted "date" ) the formula will be:=A1+1to calculate the date of a week later the formula will be:=A1+7

Tips on Excel Date and Time Functions and Formulas

If you enter the  date 2/1/2005 in cell A1 and the number format of the cell is " General" you will see 38394. This is a " Serial number" and it is the way Excel works with  dates and times. When

Page 5: Understanding Excel

you format the cell or use one of the functions below the serial number is viewed as times and dates

To enter the date of the day no need to key it in, click and hold the CTRL key and click on the semi-colon key ( ) and there is the date.

To enter the time, click and hold both the Shift and the CTRL keys and click on the colon key (:) and there is the time.

Microsoft Excel doesn't work with dates and times, it works with serial numbers This means that when you enter 12/25/2004 Excel sees 38346 and   if you enter 12/26/2004 Excel sees 38347. When you enter 12:00:00 PM Excel reads 0.5 and if you write 12:00:01 PM Excel reads 0.5000116. It is when you format the cell " Format/Cells" that you can read dates and times as we humans are accustomed to see them.

By the way, I was born on 18373 at 0.25 so I am an Aries, and you?

This being said, most functions of the category Date & Time are quite easy to work with when you use the right cell format. For example, when you are adding times and expect the total to be over 24 hours you must set the format of the result cell to " Format/Cells/Time/37:30:55"

If you develop a time management application don't go through the trouble of working with clock time. Ask your people to enter either the number of hours worked by projects or the number of minutes then work with regular numbers. Much easier.

Examples of basic Excel Date and Time Formulas

DATEDIF

One note to start. If you go to the menu " Insert/Function" you won't find this function. Excel has forgotten it. Here is how it works. Let's say that you have the dates 1/16/2005 in cell A1 and 1/16/2006 in cell B1:=DATEDIF(A1,B1,"y") will return 1=DATEDIF(A1,B1,"m") will return 12=DATEDIF(A1,B1,"d") will return 365

DAY, MONTH, YEAR

With a date in A1 like 12/15/2005 the formulas =DAY(A1), =MONTH(A1) and =YEAR(A1)   will return 15, 12 and 2005.

SECOND, MINUTE, HOUR

With a TIME  in A1 like 1:31:45PM the formulas =SECOND(A1), =MINUTE(A1) and =HOUR(A1)   will return 1, 31  and 45.

Page 6: Understanding Excel

WEEKDAY

If the  date in A1 is 1/16/2006 and it is a Monday the formula =WEEKDAY(A1) will return 2. For most users day 1 is Sunday. Check what your system says because in some cases day 1 is Monday.

DATE, DAY, MONTH, YEAR

With the DATE function, the arguments are always in the following order (year,month,day) whatever the date format specified in your regional parameters.

With a date in cell A1 the formula to add a day is:=DATE(YEAR(A1),MONTH(A1),DAY(A1)+1)the formula to add a week is :=DATE(YEAR(A1),MONTH(A1)+1,DAY(A1)+7)the formula to add a month is:=DATE(YEAR(A1),MONTH(A1)+1,DAY(A1))the formula to add a year is:=DATE(YEAR(A1)+1,MONTH(A1),DAY(A1))the last day of the month preceding the date in A1 is:=DATE(YEAR(A1),MONTH(A1),DAY(A1)-DAY(A1))the first day of the month following the date in A1 is:=DATE(YEAR(A1),MONTH(A1)+1,DAY(A1)-DAY(A1)+1)

MONTH, DAY, NOW, AND and IF (Anniversary Alerts)

My client wanted a spreadsheet that would tell her when it is the birthday of an employee. We created a spreadsheet with the names in column A and the dates of birth in column B. In column D was this formula =NOW()that changes date each day. In column C  we put this formula:=IF(AND(MONTH(B1)-MONTH(D1)=0,DAY(B1)-DAY(D1)=0),"Anniversary","")

We fine tuned:=IF(AND(MONTH(B1)-MONTH(D1)=0,DAY(B1)-DAY(D1)=0),"Happy Anniversary" ,IF(AND(MONTH(B1)-MONTH(D1)=0,DAY(B1)-DAY(D1)>0,DAY(B1)-DAY(D1)<7)," Anniversary coming" ,"" ))

Copy/paste the formula above in your spreadsheet. If you want to be alerted more that a week before the anniversary change the 7 for 30 in the formula. This way you will be alerted a month in advance.

If you are using a version of Excel earlier than 2007 you need to activate the " Excel Analysis Toolpack" to make a few  of the functions above available.

Page 7: Understanding Excel

Excel Functions and Formulas Sitemap

In annex 4 you have found a description of all 53 Excel functions in the "Financial" category. Below is the list of the 4 most useful ones.

Functions What it Does

FV Returns the future value of an investment

NPER Returns the number of periods for an investment

PMT Returns the periodic payment for an annuity

RATE Returns the interest rate per period of an annuity

If you are using a version of Excel earlier than 2007 you need to activate the "Excel Analysis Toolpack" to make some of the functions above available.

The RATE Function

The question to which RATE  brings an answer to is:- What is the real interest rate if they ask me for a certain amount each period to pay a loan?

  A Descriptions

1 48 Number of periods (years, months, weeks..etc)

2 $550 Periodic payment

3 $24,000 Total amount of loan

4 0The balance left to pay at the end of the period. If you omit this argument Excel uses "0".

5 0

Payment made at the beginning of the period (1) or at the end of the period (0). If you omit this argument Excel uses "0" saying that the payment is made at the end of each period which is usually the reality when you borrow money.

Page 8: Understanding Excel

6 5.00%

The result with the formula using the RATEfunction.Note: the format of this cell must be "Percentage" with any number of decimals. In this example the number of decimals is 2

Here is the formula in cell A6:=RATE(A1,-A2,A3,A4,A5)*12

Notes on the formula: The payment argument is negative (-A2); If you use months as periods and you want an annual rate you multiply by 12, if you use a years as periods and you want an annual rate you don't multiply......; If you don't use the "Percentage" format in cell A6 the result of this example will be 0.05; The formula could also be=RATE(A1,-A2,A3)*12 the arguments in A4 and A5 being optional

The PMT Function

The question to which PMT brings an answer to is:- If I borrow a certain amount of money and I want it repaid at the end of a certain period of time what will be the periodic payment?

  A Descriptions

1 5.00%The annual interest rate.Note: the format of this cell must be "Percentage" with any number of decimals. In this example the number of decimals is 2

2 48Number of periodic payments (years, months, weeks)

3 $24,000 Total amount of loan

4 0The balance left to pay at the end of the period. If you omit this argument Excel uses "0".

5 0

Payment made at the beginning of the period (1) or at the end of the period (0). If you omit this argument Excel uses "0" saying that the payment is made at the end of each period which is usually the reality when you borrow money.

6 -$550.41 The result with the formula using

Page 9: Understanding Excel

thePMT function.

Here is the formula in cell A6:=PMT(A1/12,A2,A3,A4,A5)

Notes on the formula: If you don't use the "Percentage" format in cell A1 enter 0.05; If you use months as periods the rate must be divided by 12 (A1/12), if you use weeks then you divide by 52 (A1/52), if there are 4 payments per year you will divide the rate by 4 (A1/4)and if the payment is annual you don't divide the rate argument (A1) ; The formula could also be =PMT(A1/12,A2,A3) the arguments in A4 and A5 being optional; If you want the payment to show as a positive value add a minus sign before the equal sign (=-PMT(A1/12,A2,A3,A4,A5))

The FV Function (Future value)

The question to which FV  brings an answer to is:- If I put a certain amount of money in the bank each month how much money will I have saved at the end of a certain period of time?

  A Descriptions

1 5.00%The annual interest rate.Note: the format of this cell must be "Percentage" with any number of decimals. In this example the number of decimals is 2

2 48 Number of periodic deposits (years, months, weeks)

3 $550 Amount of periodic deposits

4 $0 Beginning balance. If you omit this argument Excel uses "0".

5 1

Deposits made at the beginning of the period (1) or at the end (0). If you omit this argument Excel uses "0". In the case of the FV function make sure that you enter "1".

6 -$29,279.68 The result with the formula using the FV function.

Here is the formula in cell A6:=FV(A1/12,A2,A3,A4,A5)

Notes on the formula: If you don't use the "Percentage" format in cell A1 enter 0.05; If you use months as periods the rate must be divided by 12 (A1/12), if you use weeks then you divide by 52 (A1/52), if there are 4 payments per year you will divide the rate by 4 (A1/4)and if the

Page 10: Understanding Excel

payment is annual you don't divide the rate argument (A1) ; The formula could also be =FV(A1/12,A2,A3) the arguments in A4 and A5 being optional; If you want the RESULT to show as a positive value add a minus sign before the equal sign (=-FV(A1/12,A2,A3,A4,A5))

The NPER Function

The question to which NPER  brings an answer to is:- How many months would it take me to repay a certain loan at a certain interest rate if I pay a certain amount each month?

  A Descriptions

1 5.0%The annual interest rate.Note: the format of this cell must be "Percentage" with any number of decimals. In this example the number of decimals is 2

2 $550 Periodic payment

3 $24,000 Total amount of loan

4 0The balance left to pay at the end of the period. If you omit this argument Excel uses "0".

5 0Payment made at the beginning of the period (1) or at the end (0). If you omit this argument Excel uses "0".

6 48.26The result with the formula using the NPERfunction.

Here is the formula in cell A6:=NPER(D1/12,-D2,D3,D4,D5)

Notes on the formula: If you don't use the "Percentage" format in cell A1 enter 0.05; The second argument MUST BE NEGATIVE; If you use months as periods the rate must be divided by 12 (A1/12), if you use weeks then you divide by 52 (A1/52), if there are 4 payments per year you will divide the rate by 4 (A1/4)and if the payment is annual you don't divide the rate argument (A1) ; The formula could also be =NPER(A1/12,A2,A3) the arguments in A4 and A5 being optional;

Excel Functions and Formulas Sitemap

Page 11: Understanding Excel

In annex 5 you have found a description of all 17 Excel functions in the "Information" category. Below is the list of the 2 most useful ones. See more on the very powerful ISERROR fonction.

Functions What it Does

ISERROR Returns TRUE if the value is any error value

CELL  Returns information about the formatting, location, or contents of a cell

 

Examples of Basic Information Formulas

CELL, MID, FIND

If you want the name and path of the active spreadsheet to be entered automatically in a cell, use the formula:=CELL("filename" )if you want only the filename use :=MID(CELL("filename" ,A1),FIND("[" ,CELL("filename" ,A1))+1,FIND("]" ,CELL("filename" ,A1))-FIND("[" ,CELL("filename",A1))-1)

ISERROR/ISNA

When a formula refers to a cell in which you have another formula, always use the ISERROR function to avoid trashing the last formula with a " #DIV/0" or a " #VALUE" or a " #N/A" .=IF(ISERROR(B1/A1),"",(B1/A1))if the value of cell A1 is 0, the cell in which you have put the above formula will be empty and not carry a value of #DIV/0.=IF(ISERROR(B1/A1),0,(B1/A1))if the value of cell A1 is 0, the value of the cell in which you have put the above formula will be 0 and not #DIV/0.I also use the ISERROR rather then the ISNA function when I work with INDEX/MATCH.

IF, ISNUM, LEFT  and MID

In UK all postal codes start by a prefix of one or two letters. My correspondent wanted a formula to extract the prefixes so he could make a list of them. With the postal codes in column one the

Page 12: Understanding Excel

following formula in column 2 would do the job.=IF(ISNUMBER(MID(A1,2,1)*1),LEFT(A1,1),LEFT(A1,2))Depending on the number of characters in the prefix the formula should return the first  character from the left or the first 2  characters from the left: LEFT(A1,1) or LEFT(A1,2)Before any of these solutions is applied we must check if there are one or two letters at the beginning of the postal code. To do so we will check if the second character MID(A1,2,1)  is a number. The problem here is that any character from a text string is consider as a letter by Excel. Postal codes, serial numbers and others that include a letter or are formatted as text  are text by nature . So we multiply the second character by 1. If the character is a digit  to begin with it becomes a number but if it is a letter it doesn't: ISNUMBER(MID(A1,2,1)*1). 

Excel Functions and Formulas Sitemap

 

In annex 6 you have found a description of all 7 Excel functions in the "Logical" category. Below is the list of the 4 most useful ones. See more on IFERROR in lesson 25

Functions What it Does

AND Returns TRUE if all its arguments are TRUE

IF Specifies a logical test to perform

NOT Reverses the logic of its argument

OR Returns TRUE if any argument is TRUE

New in Excel 2007

IFERRORReturns a specified value if the formula results in an error otherwise returns the result of the formula

Tips

You cannot use an IF formula to change the color of the font or of the cell's background based on a value (criteria). To do so you will use " Conditional Formatting" .

Page 13: Understanding Excel

When you develop a condition for an IF formula it is not case sensitive.

The basic IF formula looks like this =IF(condition,value if condition is True,value if condition is False). So=IF(A1=1,9,8) in plain English means if the value of cell A1 is 1 the value in which this formulas resides is 9 otherwise it is 8.

Remember that you cannot nest more than 7 IFs within the same formula. Nested IFs are IFs within IFs like in=IF(A1> =90,"A" ,IF(A1> =80,"B" ,"C"). In other words if a condition is true you want to test another condition in such cases we are talking about nested IFs. In plain English this formula says: if the value of cell A1 is equal or higher than 90 the result in the cell where this formula resides is the capital letter "A" , if the value in cell A1 is 80 or greater then the result is "B" else the result is "C" . Below you will see a way to go around this limit.

Examples of Basic Excel Logical Formulas

In this section I can only give you examples of simple IF formula because OR and AND are not used by themselves.

IF

The basic IF formula looks like this =IF(A1=100,9,8). In plain English it means if the value of cell A1 is 100 the value in which this formulas resides is 9 otherwise it is 8.

You can also write =IF(A1< > 100,9,8). In plain English it means if the value of cell A1 is DIFFERENT than  100 the value in which this formulas resides is 9 otherwise it is 8. Using the " smaller than sign" (< ) and the " greater than sign" (> ) means different than.

You can also write =IF(A1=> 100,9,8). In plain English it means if the value of cell A1 is equal to or greater than 100 the value in which this formulas resides is 9 otherwise it is 8. Remember the order: the equal sign is first.

When you use text value you nee to use the double quotes.You will  write =IF(A1="Peter" ,9,8). In plain English it means if the value of cell A1 is Peter then the value in which this formulas resides is 9 otherwise it is 8.

You will  write =IF(A1=1," Peter" ,8). In plain English it means if the value of cell A1 is equal to 1  then the value in which this formulas resides is Peter otherwise it is 8.

Finally if you want to say that if the value of cell A1 is equal to 1 the result should be an empty cell or a space you will write:=IF(A1=1," " ,8) for the space (notice the space between the double quotes

Page 14: Understanding Excel

=IF(A1=1,,8)  or =IF(A1=1," " ,8) for the empty cell. It is either nothing between the two commas or a set of double quotes with nothing in between.

IF, AND and OR

You may set more than one condition and link them with AND or OR. You write  all the conditions separated by commas within a set of parentheses.

Using AND or OR is easy it is the logic that in sometimes mind boggling.   For example=IF(AND(A1=1,A1< > 2),9,8)means that if the value of cell A1 is equal to 1 and  different than 2  return 9 else return 8. Now remember that for the formula to return a 9 the value in cell A1 MUST respect BOTH conditions. All numbers are different than 2 including 1 but only 1 respects both conditions so the formula could simply be:=IF(A1=1,9,8)

=IF(OR(A1=1,A1<> 2), 9,8)means that  if the value of cell A1 is equal to 1 or different than 2  return 9 else return 8.  In this case a 9 is returned for any value that respects ONE OF THE conditions. The number 1 respects both  conditions and all other numbers except 2 respect at least one condition so again this formula could simply be:=IF(A1<> 2,9,8)

IF, AND or  OR?

Let's say that you want to give a B to a student whose grades are between 75 and 85. Should you write:=IF(OR(A1=< 85,A1=> 75),"B" ," ")or=IF(AND(A1=< 85,A1=> 75),"B" ," ")

Let's look at the first formula. Any number that respects ANY of the two conditions will result B. 95 is good because it is larger than 75. 78 is good because it respects both conditions. 35 is also good because it is smaller than 85. So this formula is wrong.

Only the numbers between and including 75 and 85 respect BOTH conditions and will result in a B. All the other numbers only respect ONE of the conditions and are excluded. So the second formula is the right one.

I have been working with numbers for more than 30 years now and I still doubt my own logic. My advice is TEST YOUR LOGIC FORMULAS.

Page 15: Understanding Excel

IF (Nested)

You will not be confronted with this situation often but let's illustrate the solution to the limit of 7 nested IFs. You will need as many formulas as you have groups of 6 conditions.   For example suppose you want to replace numbers by letters 1=A, 2=B and so on and the number submitted is in cell A1. For values of A1 from 1 to 12   you will need 3 formulas in 3 different cells. The formula in B1 will be:=IF(A1=1,"A" ,IF(A1=2,"B" ,IF(A1=3,"C" ,IF(A1=4,"D" ,IF(A1=5,"E" ,IF(A1=6,"F" ," " ))))))notice that if the value of cell A1 is larger than 6 the result is an empty cell. Notice that there are the same number of closing parentheses as of opening parentheses.the formula in C1 will be:=IF(A1=7,"G" ,IF(A1=8,"H" ,IF(A1=9,"I" ,IF(A1=10,"J" ,IF(A1=11,"K" ,IF(A1=12,"L" ," " ))))))and the formula in C1 to show the final result will be a concatenation of the results in B1 and C1=B1 & C1Hide columns B and C.

IF, NOW

You have a list of receivables with the date due in column " D" , the following formula in column E will show " Overdue" if the date in column C is earlier than today and will show nothing if the date is later.=IF(D1< NOW(),"Overdue" ,"" )In plain English: if the date in C1 is earlier than today (NOW() in Excel language) then write " Overdue" if not do not write anything (" " in Excel language).

If you want to know what accounts will be overdue in 30 days you will write:=IF(D1< NOW()+30,"Overdue" ,"" )

And if you want to see what accounts are overdue based on a date in cell G2 for example you will use this very simple:=IF(D1< G2,"Overdue" ,"" )

IF

You are a teacher and you want to transform numerical grades into letter grades, here is the formula:=IF(A1> =90,"A" ,IF(A1> =80,"B" ,IF(A1> =70,"C" ,IF(A1> =60,"D" ,"E" ))))

IF, ISNUMBER, LEFT  and MID

In UK all postal codes start by a prefix of one or two letters. My correspondent wanted a formula to extract the prefixes so he could make a list of them. With the postal codes in column one the following formula in column 2 would do the job.=IF(ISNUMBER(MID(A1,2,1)*1),LEFT(A1,1),LEFT(A1,2))

Page 16: Understanding Excel

Depending on the number of characters in the prefix the formula should return the first  character from the left or the first 2  characters from the left: LEFT(A1,1) or LEFT(A1,2)Before any of these solutions is applied we must check if there are one or two letters at the beginning of the postal code. To do so we will check if the second character MID(A1,2,1)  is a number. The problem here is that any character from a text string is consider as a letter by Excel. Postal codes, serial numbers and others that include a letter or are formatted as text  are text by nature . So we multiply the second character by 1. If the character is a digit  to begin with it becomes a number but if it is a letter it doesn't: ISNUMBER(MID(A1,2,1)*1).

IF, MOD, TRUNC and &

How many dozens are there in 106 units?With the number of units in cell A1 the formulas in B1:=TRUNC(A1/12,0) will return the number of   complete dozensthis formula in C1:=MOD(A1,12) will return the number of units left when the total number is divided by 12. 

If you want to present the result as " 8 dozens and 10  units" in a single cell you will use the following formula combining math & Trig functions and the ampersand (& ) sign:=TRUNC(A1/12) & " dozens and " & MOD(A1,12) & " units" But what if there are 96 units and you don't want the result to show as "8 dozens and 0  units" but as "8 dozens" . You will then use this formula:=IF(MOD(A1,12)=0,TRUNC(A1/12) & " dozens" ,TRUNC(A1/12) & " dozens and " & MOD(A1 12) & " units" )

IF, MOD, TRUNC and & How many dozens are there in 106 units?With the number of units in cell A1 the formulas in B1:=TRUNC(A1/12,0) will return the number of   complete dozensthis formula in C1:=MOD(A1,12) will return the number of units left when the total number is divided by 12. 

If you want to present the result as "8 dozens and 10  units" in a single cell you will use the following formula combining math & Trig functions and the ampersand (& ) sign:=TRUNC(A1/12) & " dozens and " & MOD(A1,12) & " units" But what if there are 96 units and you don't want the result to show as " 8 dozens and 0  units" but as " 8 dozens" . You will then use this formula:=IF(MOD(A1,12)=0,TRUNC(A1/12) & " dozens" ,TRUNC(A1/12) & " dozens and " & MOD(A1 12) & " units" )

DATEDIF, NOW, AND and IF

My client wanted a spreadsheet that would tell her when it is the birthday of an employee. We created a spreadsheet with the names in column A and the dates of birth in column B. In column

Page 17: Understanding Excel

D was this formula =NOW()that changes date each day. In column C  we put this formula:=IF(AND(MONTH(B1)-MONTH(D1)=0,DAY(B1)-DAY(D1)=0),"Anniversary","")

We fine tuned:=IF(AND(MONTH(B1)-MONTH(D1)=0,DAY(B1)-DAY(D1)=0),"Happy Anniversary" ,IF(AND(MONTH(B1)-MONTH(D1)=0,DAY(B1)-DAY(D1)>0,DAY(B1)-DAY(D1)<7)," Anniversary coming" ,"" ))

Copy/paste the formula above in your spreadsheet. If you want to be alerted more that a week before the anniversary change the 7 for 30 in the formula. This way you will be alerted a month in advance.

Excel Functions and Formulas Sitemap

 In annex 7 you have found a description of all 18 Excel functions in the "LookUp and Reference" category. Below is the list of the 5 most useful ones. See more on the very powerful INDEX/MATCH Excel formulas in lesson 12 and in the three old lookup functions in lessons 17,  18 and 19: HLOOKUP function,LOOKUP fonction and VLOOKUP function.

Functions What it Does

INDEX Uses an index to choose a value from a reference or array(Powerful in INDEX/MATCH Formulas)

MATCH Looks up values in a reference or array(Powerful in INDEX/MATCH Formulas)

INDIRECT Returns a reference indicated by a text value

OFFSET  Returns a reference offset from a given reference

ADDRESS Returns a reference as text to a single cell in a worksheet

 

The most important functions in this category

INDEX, MATCH

See lesson 12 on INDEX/MATCH

Page 18: Understanding Excel

The LOOKUP Group

The functions in this group are widely known among  advanced users. But once they discover the more powerful and less limited INDEX/MATCH they are kind of pushed aside. Click on the links below to access the pages of this website describing how they work and what is their limits.

Excel Lesson 17 - Excel HLOOKUP Function Excel Lesson 18 - Excel LOOKUP Function Excel Lesson 19 - Excel VLOOKUP Function

Other Functions

When you start developing more complex business models or when you want to calculate and chart moving averages and moving " Year to Date" you will need the two following functions.

INDIRECTIf in cell A1 of Sheet1 you have this value (Sheet2!A1) and in cell A2 of Sheet1 you have the following formula:=INDIRECT(A1) the result will be the value of  cell A1 of Sheet2.

OFFSETThe most intellectually challenging function in Excel.

The general format of this function goes as follows:=SUM(OFFSET(D1,1,1,3,3))In plain English...sum the range of 3 rows by three columns that starts 1 row below and one column to the right of D1 (the anchor). So if you have 2  in all 9 cells E2 to G4 the result will be 18.

Tutorial and Examples

With INDEX and MATCH you can semi automate your invoices so that when you enter the name of a client it's address appears in the cell below and when you enter the product number it's description appears in the cell to the right.See all this with step by step detailed instructions in the worbooks that you can download from this site.

Excel Functions and Formulas Sitemap

Page 19: Understanding Excel

In annex 8 you have found a description of all 50 Excel functions in the "Mathematical" category. Below is the list of the 9 most useful ones. See more on the very powerful SUMPRODUCT function in Excel in lesson 11, more on the SUBTOTAL function in lesson 13, more on the obsolete SUMIF function in lesson 15 and more on the new SUMIFS function in lesson 24.

Functions What it Does

SUM Adds its arguments

SUMPRODUCT The most powerful and useful function in Excel

ROUND Rounds a number to a specified number of digits

ROUNDUP Rounds a number up, away from zero

SUBTOTAL Returns a subtotal of a filtered list or database)

TRUNC Truncates a number to an integer

INT Rounds a number down to the nearest integer)

ABS Returns the absolute value of a number

MOD Returns the remainder from division

POWER Returns the result of a number raised to a power

SQRT Returns a positive square root

In Excel 2007 and Up

SUMIFS Adds the cells specified by one or many given criteria(SUMPRODUCT does better)

 

TipsRead other general tips on formulas in the Introduction to this section on Excel Functions and Formulas

When you specify in the format of a cell that you want only 2 decimals Excel shows only 2 decimals (rounding up) BUT it still uses all the decimals. For example if in cell A1 you enter 2.1456 and format it to show only 2 decimals you will see 2.15. Now if in cell B1 you write the formula =A1 and make the format "General" you will see that Excel is using all 4 decimals (2.1456). This is why you will need to use functions like INT, TRUNC, ROUND, ROUNDUP and ROUNDDOWN if you want to use a specific number of decimals in your calculations.

SUM

=SUM(A1,B6,G6) or =SUM(A1+B6+G6) will return the sum of the values in cells A1, B6 and G6=SUM(A1:A23) will return the sum of the values in cells A1 to A23

Page 20: Understanding Excel

=SUM(A1:A23,F3:F34) will return the sum of the values in cells A1 to A23 plus the sum of the values in cells F3  to F34

In cell B2 of a yearly summary you want to sum the values in cells B2 of each of the monthly sheets. You have named your sheets "January" , "February" ....and you have used:=January!B2+February!B2+March!B2...+December!B2You can also write this:=SUM(January:December!B2)

TRUNC

I don't use the INT or ROUNDDOWN functions because TRUNC does the same thing and more. The TRUNC function removes decimals without rounding. If you have 2.2 or 2.7 in cell A1 =TRUNC(A1,0) will return 2. Interestingly enough if you have 12,345 in B1 using a minus sign in the second argument of TRUNC =TRUNC(B1,-3) will return  (12,000). Handy when you don't want to show the hundreds, the tens and units in a report.

ROUND

This function removes decimals rounding up the last decimal if the next one is 5 or over. So if you have 4.126 in cell A1 and use the formula =ROUND(A1,2) the result will be 4.13 if the value in A1 is 4.123 the result will be 4.12.

ROUNDUP

This function does the same thing as the function ROUND but always rounds up. So if you have 4.126 in cell A1 and use the formula =ROUNDUP(A1,2) the result will be 4.13 if the value in A1 is 4.123 the result will still be 4.13.

ABS

=ABS(A1) will return 5 if in cell A1 you have -5 or 5. This functions removes the sign.

MOD

The modulo is what is left after a division. =MOD(20,6) is 2 because you have 3 times 6 in 20 and the rest is 2. Notice the use of the comma to separate the arguments. See an application below in determining the age of a person.

SUMIF

See Excel Lesson 15 - Excel SUMIF Function

SUMPRODUCTThe best kept secret in Microsoft Excel

Here is what Excel says you can do with SUMPRODUCT:

Page 21: Understanding Excel

Let's say that you have a series of quantities in cells A1 to A5 and a series of unit prices in B1 to B5. With SUMPRODUCT you can calculate total sales with this formula: =SUMPRODUCT(A1:A5,B1:B5)

Basically SUMPRODUCT sums A1 multiplied by B1 plus A2 multiplied by B2.........

In the last 20 years I have used SUMPRODUCT for the purpose presented by Excel once or twice. But I use SUMPRODUCT daily to solve all kinds of other business data problems. It is the most powerful and useful function in Excel. Read chapter 13 that is entirely dedicated to SUMPRODUCT

SUBTOTAL

One of the giant steps (no. 2) that users make is when they learn about the database functionalities in Excel. When you know how to filter data then SUBTOTAL becomes a very interesting function.

The function SUBTOTAL allows (among other operations) to count, to sum or to calculate the average of filtered elements of a database. The function requires two arguments, the second is the range covered by the function and the first is a number between "1" and "11" that specifies the operation to be executed (for ex. "1" is for average, "2" is for count and "9" is for sum).=SUBTOTAL(9,B2:B45)

SQRT

Extracting a square root is finding the number that multiplied by itself will result in the number that you are testing. Extracting a cubic  root is finding the number that multiplied by itself two times will result in the number that you are testing. Extracting the  fourth  root is finding the number that multiplied by itself 3 times will result in the number that you are testing.

To extract the square root of a number you will use a formula like:=SQRT(16) that will result in 4 because 4 multiplied by 4 is 16 or=SQRT(A1) that will also result in 4  if the value in cell A1 is 16.

There are no specific Excel function to extract the cubic root or any other root. You have to trick the POWER function into doing it.

POWER

You can raise a number to a power (multiplying it by itself a certain number of times with this function. Hence:=POWER(4,2) will result in 16  (4 times 4) or=POWER(A1,2) will also result in 16  if the value in cell A1 is 4.

You can  to trick the POWER function into extracting the square root, the cubic root and any other root by submitting a fraction as second argument. For example you can extract the square

Page 22: Understanding Excel

root of 16 with the formula =POWER(16,1/2), the cubic root with =POWER(16,1/3) and so on. 

ROUND, SUM=ROUND(SUM(A1:A5),2) will return the sum of A1 to A5 rounded to 2 decimals.

IF, MOD, TRUNC and & How many dozens are there in 106 units?With the number of units in cell A1 the formulas in B1:=TRUNC(A1/12,0) will return the number of   complete dozensthis formula in C1:=MOD(A1,12) will return the number of units left when the total number is divided by 12. 

If you want to present the result as "8 dozens and 10  units" in a single cell you will use the following formula combining math & Trig functions and the ampersand (& ) sign:=TRUNC(A1/12) & "dozens and " & MOD(A1,12) & " units" But what if there are 96 units and you don't want the result to show as "8 dozens and 0  units" but as "8 dozens" . You will then use this formula:=IF(MOD(A1,12)=0,TRUNC(A1/12) & " dozens" ,TRUNC(A1/12) & " dozens and " & MOD(A1 12) & " units" )

INT, TRUNC, MOD  and & You want to determine the age of a person. If in cell " A3" you enter the date of birth, and in cell " B3" today's date, the following formula in " C3" would give you a good approximation of the age (plus or minus a few days):=INT((B3-A3)/365) & " years and " & TRUNC((MOD((B3-A3) 365))/30) & " months"

If in cell A3 you enter the date of birth  and in B3 you enter the formula =NOW() then each day when  you open the workbook the age of the person is re-calculated in cell C3

In annex 9 you have found a description of all 83 Excel functions in the "Statistical" category. Below is the list of the 7 most useful ones.  See more on the obsolete function COUNTIF in lesson 14, more on the MIN, MAX, SMALL, LARGE functions in lesson 20 and more on the 3 new 2007 Excel functions COUNTIFS, AVERAGEIFand AVERAGEIFS in lessons 23, 21 and 22.

Functions What it Does

AVERAGE Returns the average of its arguments

COUNT Counts how many numbers are in the list of arguments

AVERAGEA Returns the average of its arguments, including numbers, text,

Page 23: Understanding Excel

and logical values

COUNTA Counts how many values are in the list of arguments)

RANK Returns the rank of a number in a list of numbers

LARGE Returns the k-th largest value in a data set

SMALL Returns the k-th smallest value in a data set

New Functions in Excel 2007

AVERAGEIFCalculates the average within a range that meet a given criteria(SUMPRODUCT does better)

AVERAGEIFSCalculates the average within a range that meet one or many given criteria (SUMPRODUCT does better)

COUNTIFSCounts the number of nonblank cells within a range that meet the given criteria (SUMPRODUCT does better)

LARGE, SMALL

And what if you want the second or third largest value or the second smallest value. Use LARGE and SMALL like this:=LARGE(A1:A5,2), =LARGE(A1:A5,3), =SMALL(A1:A5,2)You can use these functions with dates.

As a matter of facts you can forget about MIN and MAX with:=LARGE(A1:A5,1), =SMALL(A1:A5,1)

COUNT and  COUNTA

If you want to count the number of cells that are not blank COUNT and COUNTA will return a different result if in one of the cells there is a text. OR A SPACE=COUNT(A1:A5) will return 5 is only numbers OR DATES are present in cells A1 to A5 and 4 if there is a letter, an empty cell OR A SPACE in one of the cells. The SPACE thing is important to remember when you are importing data from an external source.=COUNTA(A1:A5) will return 5 unless one of the cells is empty. If all the cells contain numbers, letters OR SPACES the result will be 5.

Page 24: Understanding Excel

AVERAGE and AVERAGEA

Watch for dates! If you want the average of a range and there is a date within there is a problem because dates are numbers. If all the cells are dates, indeed you can calculate the average date of.... The difference between AVERAGE and AVERAGEA becomes evident when one of the cells contains a text OR A SPACE and don't forget the SPACE. A cell containing a space is NOT empty.

Excel Functions and Formulas Sitemap

 

 

In annex 10 you have found a description of all 24 Excel functions in the "Text" category. Below is the list of the 9 most useful ones.

Functions What it Does

LEFT Returns the leftmost characters from a text value

LEN Returns the number of characters in a text string

MIDReturns a specific number of characters from a text string starting at the position you specify

RIGHT Returns the rightmost characters from a text value

TRIM Removes spaces from text

FIND Finds one text value within another (case-sensitive)

REPT Repeats text a given number of times

TEXT Formats a number and converts it to text

VALUE Converts a text argument to a number

 

Page 25: Understanding Excel

Tips

To Concatenate: To assemble strings of text. When you concatenate the result is always in text format even if your are concatenating numbers.

For example: if you have 1 in cell A1 and 2 in cell A2 the formula =A1+A2 will return 3. If instead of the plus sign (+) you use the ampersand (& ) the formula =A1 & A2 will return 13 because concatenating is not adding it is creating a chain of characters with the content of many cells. The result 13 is not even a number with which you could execute calculations it is a text just like Peter.

The TEXT functions in Excel are great "Time Saving" tools. When you have data that you receive from colleagues, clients or  suppliers, when you download data from a database or the Internet and the format is not right for you, you need to RE-ENTER the data manually and this task is time consuming, error prone and very frustrating. The TEXT functions will allow you to do the reformatting automatically.

I have developed hundreds of spreadsheets to convert data and make them usable within Excel. I have also developed spreadsheets to convert large quantities of Excel data into a format uploadable in large databases (Oracle, Sybase, SQL Server...) or ERP systems (JDEdwards, SAP, PeopleSoft, SmartStream...) as batch files.

Excel is a great translator to move data from one system to the other. You download data from system A, convert and either use it in Excel or  upload in system B.

Basic Excel Formulas using TEXT Functions

CONCATENATE and the ampersand (& )If you have "Peter" in cell A1 and "Clark" in cell B1 the following formula in cell C1 will return "Peter Clark" :=CONCATENATE(A1," " ,B1)With this formula you are telling Excel to assemble the content of cell A1, a space (between quotes) and the content of cell C1.a simpler way to get the same result:=A1 & " " & B1The ampersand (& ) is the sign used to tell Excel to concatenate strings of text. Most users prefer the ampersand to the CONCATENATE function.

FIND or SEARCHWith " Peter Clark" in cell A1 the formula =FIND(" " ,A1) will return 6 because the space is the sixth character from the left. This function is very useful to remove parts of a string of characters when there is a constant within it. FIND and SEARCH perform the same task but FIND is case sensitive and  SEARCH is not.

Page 26: Understanding Excel

LEFT, RIGHT, MIDIf you have Peter Clark in cell A1 these formulas in cell B1 to B3:=RIGHT(A1,2) will return "rk" =RIGHT(A1,5) will return " Clark" =LEFT(A1,2) will return "Pe" =LEFT(A1,5) will return "Peter" =MID(A1,7,3) will return "Cla" because you are asking Excel to extract 3 characters starting with the seventh from the left.

LENThe function LEN returns the number of characters in a string. Like many functions of the TEXT category LEN is a function that is rarely used by itself The basic LEN formula looks like this:=LEN(A1)If cell A1 contains "Peter" the answer will be 5, with "Peter Clark" the answer is 11 because the space is a character

REPTThe REPT function is indispensable when you want to upload a series a values that are in different columns in Excel to an old database or to an A/S400 database. These databases and certain other accounting programs have fixed width fields. For example the " amount" field can be 10 characters wide so even if the amount that you have is 3.35 (In cell A1) you need to upload 0000000335=REPT(0,8) & A1 will return 0000000335

TEXTI use this function to make sure that Excel sees a string of characters and not a number. If you have 3567 in cell A4,=TEXT(A4,"@") will return 3567 and you know that it works because the string although looking like a number is aligned to the left of the cell. This function is particularly important when working with numerical part numbers or account numbers  specially with SUMPRODUCT  and INDEX/MATCH.

TRIMSometimes when you download data from certain databases you have in cell A1 either "Peter     Clark" with five spaces between Peter and Clark or "Peter Clark     " with 5 spaces at the end of the name or "     Peter Clark" with 5 spaces at the beginning, =TRIM(A1) will return the same result "Peter Clark" with no space at the beginning or the end and a single space in between. The TRIM function only removes what Excel considers as useless spaces.

VALUESometimes when you download data from certain databases the numbers are in text format and you cannot use them in calculations. You will use the following formula to resolve this problem:=VALUE(A1)

Page 27: Understanding Excel

Formulas Using Many Functions

1 - The surname is in cell A1, the first name is in cell B1 and in cell C1 you want both of them separated by a comma and a space. The formula in cell C1 is:=A1 & "," & B1

2 - You download data from a database and what you have in cell A1 "Peter     " with five spaces  at the end and in B1 "Clark     " with five spaces at the end. What you want in C1 is "Peter Clark" . The formula in C1 is:=TRIM(A1) & " " & TRIM(B1)

3 - In cell A1 you have a serial number (SKU). The SKU is built like this: a letter then 3 digits for the style, three digits for the color and three digits for the print. For example A305888765 means product "A" with style number "305" , color "888" and print "765" . In cell B1 you just want the color. The formula in B1 will look like this:=RIGHT(LEFT(A1, 7) 3)

Excel Functions and Formulas Sitemap

  

 

There are 40 functions in the "Engineering" category.

Functions What it Does

BESSELI Returns the modified Bessel function In(x)

BESSELJ Returns the Bessel function Jn(x)

BESSELK Returns the modified Bessel function Kn(x)

BESSELY Returns the Bessel function Yn(x)

BIN2DEC Converts a binary number to decimal

BIN2HEX Converts a binary number to hexadecimal

BIN2OCT Converts a binary number to octal

COMPLEX Converts real and imaginary coefficients into a complex number

Page 28: Understanding Excel

CONVERT Converts a number from one measurement system to another

DEC2BIN Converts a decimal number to binary

DEC2HEX Converts a decimal number to hexadecimal

DEC2OCT Converts a decimal number to octal

DELTA Tests whether two values are equal

ERF Returns the error function

ERFC Returns the complementary error function

GESTEP Tests whether a number is greater than a threshold value

HEX2BIN Converts a hexadecimal number to binary

HEX2DEC Converts a hexadecimal number to decimal

HEX2OCT Converts a hexadecimal number to octal

IMABS Returns the absolute value (modulus) of a complex number

IMAGINARY Returns the imaginary coefficient of a complex number

IMARGUMENT Returns the argument theta, an angle expressed in radians

IMCONJUGAT Returns the complex conjugate of a complex number

IMCOS Returns the cosine of a complex number

IMDIV Returns the quotient of two complex numbers

IMEXP Returns the exponential of a complex number

IMLN Returns the natural logarithm of a complex number

IMLOG10 Returns the base-10 logarithm of a complex number

Page 29: Understanding Excel

IMLOG2 Returns the base-2 logarithm of a complex number

IMPOWER Returns a complex number raised to an integer power

IMPRODUCT Returns the product of two complex numbers

IMREAL Returns the real coefficient of a complex number

IMSIN Returns the sine of a complex number

IMSQRT Returns the square root of a complex number

IMSUB Returns the difference between two complex numbers

IMSUM Returns the sum of complex numbers

OCT2BIN Converts an octal number to binary

OCT2DEC Converts an octal number to decimal

OCT2HEX Converts an octal number to hexadecimal

Excel Functions and Formulas Sitemap

 

There are 12 functions in the "Database" category. All of them are rarely used.

Frequency * Functions What it Does

Rarely Used DAVERAGE  Returns the average of selected database entries

Rarely Used DCOUNT Counts the cells that contain numbers in a database

Rarely Used DCOUNTA  Counts nonblank cells in a database

Rarely Used DGETExtracts from a database a single record that matches the specified criteria

Rarely Used DMAX Returns the maximum value from selected

Page 30: Understanding Excel

database entries

Rarely Used DMINReturns the minimum value from selected database entries

Rarely Used DPRODUCTMultiplies the values in a particular field of records that match the criteria in a database

Rarely Used DSTDEVEstimates the standard deviation based on a sample of selected database entries

Rarely Used DSTDEVPCalculates the standard deviation based on the entire population of selected database entries

Rarely Used DSUMAdds the numbers in the field column of records in the database that match the criteria

Rarely Used DVAREstimates variance based on a sample from selected database entries

Rarely Used DVARPCalculates variance based on the entire population of selected database entries

Excel Functions and Formulas Sitemap