Logical Function
Logical Function
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)
=AND(TRUE, FALSE)
=AND(2+2=4, 2+3=5)
A
50
104
Formula
Description (Result)
=AND(1<A2, A2<100)
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)
=OR(1+1=1,2+2=5)
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)
=NOT(1+1=2)
TRUE
FALSE
Returns the logical value
FALSE.
Syntax
FALSE( )
IF
Example
A
50
Formula
Description (Result)
=IF(A2<=100,"Within
budget","Over budget")
900
500
900
500
925
Formula
Description (Result)
=IF(A2>B2,"Over
Budget","OK")
=IF(A3>B3,"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"))))
=IF(A3>89,"A",IF(A3>79,"B",
IF(A3>69,"C",IF(A3>59,"D","F"))))
=IF(A4>89,"A",IF(A4>79,"B",
IF(A4>69,"C",IF(A4>59,"D","F"))))
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)
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)
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")
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)
=FIND("m",A2)
=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)
=SEARCH(A4,A3)
=REPLACE(A3,SEARCH(A4,A3)
,6,"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)
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)
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)
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
=MID(A2,7,20)
=MID(A2,20,5)
Data
Phoenix, AZ
One
Formula
Description (Result)
=LEN(A2)
=LEN(A3)
=LEN(A4)
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(4-Jan)
=Day(26885)
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(366)
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(A3)
=Year(29747.007)
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(A3)
=HOUR(A4)
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
Data
2/14/2008
Formula
Description (Result)
=WEEKDAY(A2)
=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)