Logical
Function
AND
Returns TRUE if all its arguments are
TRUE; returns FALSE if one or more
argument is FALSE.
Syntax
AND(logical1,logical2, ...)
Logical1, logical2 ... are 1 to 30
conditions you want to test that can be
either TRUE or FALSE.
Example
Formula
Description (Result)
=AND(TRUE, TRUE)
All arguments are TRUE
(TRUE)
=AND(TRUE, FALSE)
One argument is FALSE
(FALSE)
=AND(2+2=4, 2+3=5)
All arguments evaluate to TRUE
(TRUE)
A
50
104
Formula
Description (Result)
=AND(1<A2, A2<100)
Because 50 is between 1 and 100
(TRUE)
=IF(AND(1<A3, A3<100), A3,
"The value is out of range.")
Displays the second number above,
if it is between 1 and 100,
otherwise displays a message (The
value is out of range.)
=IF(AND(1<A2, A2<100), A2,
"The value is out of range.")
Displays the first number above, if
it is between 1 and 100, otherwise
displays a message (50)
OR
Returns TRUE if any argument is TRUE;
returns FALSE if all arguments are
FALSE.
Syntax
OR(logical1,logical2,...)
Logical1,logical2,... are 1 to 30
conditions you want to test that can be
either TRUE or FALSE.
Eg:
Formula
Description (Result)
=OR(TRUE)
One argument is TRUE (TRUE)
=OR(1+1=1,2+2=5)
All arguments evaluate to
FALSE (FALSE)
=OR(TRUE,FALSE, At least one argument is TRUE
TRUE)
(TRUE)
NOT
Reverses the value of its
argument. Use NOT when you
want to make sure a value is
not equal to one particular
value.
Syntax
NOT(logical)
Logical is a value or
expression that can be
Eg:
Formula
Description (Result)
=NOT(FALSE)
Reverses FALSE (TRUE)
=NOT(1+1=2)
Reverses an equation that evaluates to
TRUE (FALSE)
TRUE
Returns the logical value
TRUE.
Syntax
TRUE( )
FALSE
Returns the logical value
FALSE.
Syntax
FALSE( )
IF
Returns one value if a condition you
specify evaluates to TRUE and
another value if it evaluates to
FALSE.
Use IF to conduct conditional tests on
values and formulas.
Syntax
IF(logical_test,value_if_true,value
_if_false)
Example
A
50
Formula
Description (Result)
=IF(A2<=100,"Within
budget","Over budget")
If the number above is less than or equal to 100, then the
formula displays "Within budget". Otherwise, the function
displays "Over budget" (Within budget)
=IF(A2=100,SUM(B5:B15),"") If the number above is 100, then the range B5:B15 is
calculated. Otherwise, empty text ("") is returned ()
Actual Expenses Predicted Expenses
1500
900
500
900
500
925
Formula
Description (Result)
=IF(A2>B2,"Over
Budget","OK")
Checks whether the first row is over
budget (Over Budget)
=IF(A3>B3,"Over
Budget","OK")
Checks whether the second row is over
budget (OK)
If Score is
Then return
Score
Greater than 89
45
From 80 to 89
90
From 70 to 79
78
From 60 to 69
Less than 60
Formula
Description (Result)
=IF(A2>89,"A",IF(A2>79,"B",
IF(A2>69,"C",IF(A2>59,"D","F"))))
Assigns a letter grade to the
first score (F)
=IF(A3>89,"A",IF(A3>79,"B",
IF(A3>69,"C",IF(A3>59,"D","F"))))
Assigns a letter grade to the
second score (A)
=IF(A4>89,"A",IF(A4>79,"B",
IF(A4>69,"C",IF(A4>59,"D","F"))))
Assigns a letter grade to the
third score (C)
Text Function
Code
Returns a numeric code for the
first character in a text string.
The returned code corresponds to
the character set used by your
computer.
Syntax CODE(text)
Text is the text for which you want
the code of the first character.
Formula
Description (Result)
=CODE("A") Displays the numeric code for A
(65)
=CODE("!") Displays the numeric code for !
(33)
CHAR
Returns the character specified by a
number. Use CHAR to translate code
page numbers you might get from
files on other types of computers into
characters.
Syntax CHAR (number)
Number is a number between 1 and
255 specifying which character you
want. The character is from the
character set used by your computer.
Formula
Description (Result)
=CHAR(65) Displays the 65 character in the set (A)
=CHAR(33) Displays the 33 character in the set (!)
CONCATENATE
Joins several text strings into one text string.
Syntax
CONCATENATE (text1,text2,...)
Text1, text2, ... are 1 to 30 text items to be
joined into a single text item. The text items
can be text strings, numbers, or single-cell
references.
Remarks
The "&" operator can be used instead of
CONCATENATE to join text items.
Data
brook trout
species
32
Formula
Description
=CONCATENATE("Stream
population for ",A2," ",A3," is
",A4,"/mile")
Concatenates a sentence from the data
above (Stream population for brook trout
species is 32/mile)
EXACT
Compares two text strings and
returns TRUE if they are exactly the
same, FALSE otherwise. EXACT is
case-sensitive but ignores formatting
differences. Use EXACT to test text
being entered into a document.
Syntax
EXACT(text1,text2)
Text1 is the first text string.
Text2 is the second text string.
First string
Second
string
word
word
Word
word
w ord
word
Formula
Description (Result)
=EXACT(A2,B2) Checks whether the strings in the first row match (TRUE)
=EXACT(A3,B3) Checks whether the strings in the second row match
(FALSE)
=EXACT(A4,B4) Checks whether the strings in the third row match (FALSE)
FIND
FIND finds one text string (find_text) within
another text string (within_text), and returns
the number of the starting position of
find_text, from the first character of
within_text.
Syntax
FIND(find_text,within_text,start_num)
Find_text is the text you want to find.
Within_text is the text containing the text you
want to find.
Start_num specifies the character at which to
start the search. The first character in
within_text is character number 1. If you omit
start_num, it is assumed to be 1.
Data
Miriam McGovern
Formula
Description (Result)
=FIND("M",A2)
Position of the first "M" in the string above (1)
=FIND("m",A2)
Position of the first "m" in the string above (6)
=FIND("M",A2,3)
Position of the first "M" in the string above, starting with the
third character (8)
SEARCH
SEARCH returns the number of the character
at which a specific character or text string
is first found, beginning with start_num.
Syntax SEARCH(find_text,within_text,start_num)
Find_text is the text you want to find.
Within_text is the text in which you want
to search for find_text.
Start_num is the character number in
within_text at which you want to start
searching.
Data
Statements
Profit Margin
margin
Formula
Description (Result)
=SEARCH("e",A2,6)
Position of the first "e" in the first string above,
starting at the sixth position (7)
=SEARCH(A4,A3)
Position of "margin" in "Profit Margin" (8)
=REPLACE(A3,SEARCH(A4,A3)
,6,"Amount")
Replaces "Margin" with "Amount" (Profit
Amount)
LEFT
LEFT returns the first character or characters
in a text string, based on the number of
characters you specify.
Syntax
LEFT(text,num_chars)
Text is the text string that contains the
characters you want to extract.
Num_chars specifies the number of
characters you want LEFT to extract.
Num_chars must be greater than or equal to zero.
If num_chars is greater than the length of text,
LEFT returns all of text.
If num_chars is omitted, it is assumed to be 1.
Data
Sale Price
Sweden
Formula
Description (Result)
=LEFT(A2,4) First four characters in the first string
(Sale)
=LEFT(A3)
First character in the second string (S)
RIGHT
RIGHT returns the last character or
characters in a text string, based on
the number of characters you
specify.
Syntax
RIGHT(text,num_chars)
text is the text string containing the
characters you want to extract.
num_chars specifies the number of
characters you want RIGHT to extract.
Data
Sale Price
Stock Number
Formula
Description (Result)
=RIGHT(A2,5) Last 5 characters of the first string (Price)
=RIGHT(A3)
Last character of the second string (r)
MID
MID returns a specific number of
characters from a text string, starting at
the position you specify, based on the
number of characters you specify
Syntax
MID(text,start_num,num_chars)
text is the text string containing the
characters you want to extract.
start_num is the position of the first character
you want to extract in text. The first character
in text has start_num 1, and so on.
num_chars specifies the number of characters
you want MID to return from text.
LEN
LEN returns the number of characters
in a text string.
Syntax
LEN(text)
text is the text whose length you want
to find. Spaces count as characters.
Data
Fluid Flow
Formula Description (Result)
=MID(A2,1,5)
Five characters from the string above, starting at the first
character (Fluid)
=MID(A2,7,20)
Twenty characters from the string above, starting at the
seventh (Flow)
=MID(A2,20,5)
Because the starting point is greater than the length of
the string, empty text is returned ()
Data
Phoenix, AZ
One
Formula
Description (Result)
=LEN(A2)
Length of the first string (11)
=LEN(A3)
Length of the second string (0)
=LEN(A4)
Length of the third string, which includes 5 spaces (8)
Date &
Time Function
Now()
Returns the serial number of the current date and
time
Remarks
Microsoft Excel stores dates as sequential serial
numbers so they can be used in calculations. By
default, January 1, 1900 is serial number 1, and
January 1, 2008 is serial number 39448 because
it is 39,448 days after January 1, 1900.
Numbers to the right of the decimal point in the
serial number represent the time; numbers to
the left represent the date. For example, the
serial number .5 represents the time 12:00
noon.
Syntax NOW(
)
Eg:
Now()
After ten minutes repeat
this
Now()
Data
Format
1/1/1900 Date
1
_General
Today()
Returns the serial number of the
current date.
Syntax
TODAY( )
Date()
Returns the sequential serial number
that represents a particular date.
Syntax
DATE(year,month,day)
Year
Month
Day
2008
Formula
Description (Result)
=DATE(A2,B2,C2)
Serial date for the date above, using the 1900 date system
(1/1/2008 or 39448)
Time()
Returns the decimal number for a
particular time.
Syntax
TIME(hour,minute,second)
Hour
Minute
Second
12
16
48
10
=TIME(A2,B2,C2) Decimal part of a day, for the first time above (0.5)
=TIME(A3,B3,C3) Decimal part of a day, for the second time above (0.700115741)
Day()
Returns the day of a date,
represented by a serial number. The
day is given as an integer ranging
from 1 to 31.
Syntax
DAY(serial_number)
Date
15-Apr-2008
Formula
Description (Result)
=DAY(A2)
Day of the date above (15)
=Day(4-Jan)
Day of the date equals 4
=Day(26885)
Day of the date equals 9
Month()
Returns the month of a date
represented by a serial number. The
month is given as an integer, ranging
from 1 (January) to 12 (December).
Syntax
MONTH (serial_number)
Date
15-Apr-2008
Formula
Description (Result)
=MONTH(A2)
Month of the date above (4)
=Month(366)
Month of the date above (12)
YEAR()
Returns the year corresponding to
a date. The year is returned as an
integer in the range 1900-9999.
Syntax
YEAR(serial_number)
Date
7/5/2008
7/5/10
Formula
Description (Result)
=YEAR(A2)
Year of the first date (2008)
=YEAR(A3)
Year of the second date (2010)
=Year(29747.007)
Year of the date (1981)
Hour()
Returns the hour of a time value. The
hour is given as an integer, ranging
from 0 (12:00 A.M.) to 23 (11:00
P.M.).
Syntax
HOUR(serial_number)
Time
3:30:30 AM
3:30:30 PM
15:30
Formula
Description (Result)
=HOUR(A2)
Hour of first time (3)
=HOUR(A3)
Hour of second time (15)
=HOUR(A4)
Hour of third time (15)
=HOUR(29447.7) Hour of time (16)
Weekday()
Returns the day of the week corresponding
to a date. The day is given as an integer,
ranging from 1 (Sunday) to 7 (Saturday), by
default.
Syntax
WEEKDAY(serial_number,return_type)
Return_type
Number returned
1 or omitted
Numbers 1 (Sunday) through 7 (Saturday).
Numbers 1 (Monday) through 7 (Sunday).
Numbers 0 (Monday) through 6 (Sunday).
Data
2/14/2008
Formula
Description (Result)
=WEEKDAY(A2)
Day of the week, with numbers 1 (Sunday) through 7 (Saturday) (5)
=WEEKDAY(A2,2) Day of the week, with numbers 1 (Monday) through 7 (Sunday) (4)
=WEEKDAY(A2,3) Day of the week, with numbers 0 (Monday) through 6 (Sunday) (3)
COUNTIF
Counts the number of cells within a range that meet
the given criteria.
Syntax
COUNTIF(range,criteria)
Rangeis one or more cells to count, including
numbers or names, arrays, or references that contain
numbers. Blank and text values are ignored.
Criteriais the criteria in the form of a number,
expression, cell reference, or text that defines which
cells will be counted. For example, criteria can be
expressed as 32, "32", ">32", "apples", or B4.
Example
Data
apples 32
oranges 54
peaches 75
apples 86
Formula Description (result)
=COUNTIF(A2:A5,"apples") Number of cells with apples in the first
column above (2)
=COUNTIF(A2:A5,A4) Number of cells with peaches in the first column
above (1)
=COUNTIF(A2:A5,A3) COUNTIF(A2:A5,A2) Number of cells with
oranges and apples in the first column above (3)
=COUNTIF(B2:B5,">55") Number of cells with a value greater than 55
in the second column above (2)
=COUNTIF(B2:B5,"<>"&B4) Number of cells with a value not equal to
75 in the second column above (3)
=COUNTIF(B2:B5,">=32")- COUNTIF(B2:B5,">85") Number of cells
with a value greater than or equal to 32 and less than or equal to 85
in the second column above (3)
Vlookup
Searches for a value in the first
column of a table array and returns a
value in the same row from another
column in the table array.
Syntax
VLOOKUP(lookup_value,table_array,col_index_
num,range_lookup)
Lookup_valueThe value to search in the first
column of the table array. Lookup_value can be a value or
a reference. If lookup_value is smaller than the smallest
value in the first column of table_array, VLOOKUP returns
the #N/A error value.
Table_arrayTwo or more columns of data. Use a
reference to a range or a range name. The values in the
first column of table_array are the values searched by
lookup_value. These values can be text, numbers, or
logical values. Uppercase and lowercase text are
equivalent.
Col_index_numThe column number in
table_array from which the matching
value must be returned.
A col_index_num of 1 returns the value in the
first column in table_array; a col_index_num
of 2 returns the value in the second column
in table_array, and so on. If col_index_num is:
Less than 1, VLOOKUP returns the #VALUE!
error value.
Greater than the number of columns in
table_array, VLOOKUP returns the #REF!
error value.
Range_lookupA logical value that specifies
whether you want VLOOKUP to find an exact
match or an approximate match:
If TRUE or omitted, an exact or approximate match
is returned. If an exact match is not found, the
next largest value that is less than lookup_value is
returned. The values in the first column of
table_array must be placed in ascending sort
order; otherwise, VLOOKUP may not give the
correct value.
If FALSE, VLOOKUP will only find an exact match. In
this case, the values in the first column of
table_array do not need to be sorted. If there are
two or more values in the first column of
table_array that match the lookup_value, the first
value found is used. If an exact match is not found,
the error value #N/A is returned.