Day 12 - Lookup and Reference Functions
Day 12 - Lookup and Reference Functions
AND():
The AND function returns TRUE if all its arguments evaluate to TRUE, and returns
FALSE if one or more arguments evaluate to FALSE.
Syntax: AND(logical1, [logical2], ...)
2. OR():
The OR function returns TRUE if any of its arguments evaluate to TRUE, and returns
FALSE if all of its arguments evaluate to FALSE.
Syntax: OR(logical1, [logical2], ...)
3. NOT():
The NOT function reverses the value of its argument.
Syntax: NOT(logical)
4. IF():
The IF function is one of the most popular functions in Excel, and it allows you to
make logical comparisons between a value and what you expect.
So an IF statement can have two results. The first result is if your comparison is True,
the second if your comparison is False.
Use the IF function, one of the logical functions, to return one value if a condition is
true and another value if it's false.
Syntax: IF(logical_test, value_if_true, [value_if_false])
5. IFERROR():
You can use the IFERROR function to trap and handle errors in a formula. IFERROR
returns a value you specify if a formula evaluates to an error; otherwise, it returns
the result of the formula.
Syntax: IFERROR(value, value_if_error)
6. IFNA():
The IFNA function returns the value you specify if a formula returns the #N/A error
value; otherwise it returns the result of the formula.
Syntax: IFNA(value, value_if_na)
7. SUMIF():
You use the SUMIF function to sum the values in a range that meet criteria that you
specify.
Syntax: SUMIF(range, criteria, [sum_range])
8. AVERAGEIF():
Returns the average (arithmetic mean) of all the cells in a range that meet a given
criteria.
Syntax: AVERAGEIF(range, criteria, [average_range])
9. COUNTIF():
Use COUNTIF, one of the statistical functions, to count the number of cells that meet
a criterion; for example, to count the number of times a particular city appears in a
customer list.
Syntax: COUNTIF(range, criteria)
Grade Basic HRA to find HRA as 10% of BASIC, if Basic is
above 3500,otherwise HRA is 12% of BASIC
A 1000 120 120
B 4000 400 400
A 5000 500 500
A 3000 360 360
TRUE TRUE 1 TRUE
if BASIC is 4000 or less then HRA as 90 TRUE FALSE 0 TRUE
9% of BASIC, otherwise HRA is 11% FALSE
of BASIC 360 FALSE TRUE TRUE
550 FALSE FALSE FALSE FALSE
270
0
to find HRA as 10% of BASIC, if Basic 120 to find HRA as 10% of BASIC, if Basic is 100
is above 3500 but less than 4500, below 3500 or basic is above 4500,
otherwise HRA is 12% of BASIC 400 otherwise HRA is 12% of BASIC 480
600 500
360 300
40 Pass
NAME GRADE BASIC HRA PF NET
AJAY A 10000 1500 800 12300
SUNIL B 5000 750 400 6150
VIJAY A 4000 600 320 4920
ANIL A 3000 450 240 3690
SUMIF
AVERAGEIF
To take the average of NET where NAMES are ending with JAY 8610
To take the average of NET where NAMES are not ending with JAY 4920
COUNTIF
2. HLOOKUP():
HLOOKUP stands for Horizontal look up. This function is used to search a value in the first row
given range, and then returns a value in the same column from a row you specify in the funct
If logical value is omitted or TRUE then values in the first row of the range must be in ascendi
order, otherwise HLOOKUP may not give you correct answer. If logical value is FALSE then ran
does not need to be sorted.
Syntax: HLOOKUP(lookup_value, table_array, row_index_num, [range_lookup])
3. LOOKUP():
It is used to search a given value in the given range. It will search for an approximate match i
exact match is not found; the next largest value that is less than search value is returned. Lo
has two formats. In the first format you have to give value to search, then single column or si
row range to search and single row or single column result range. Value is searched from sea
range and result is given from the same row/column of the result range.
In the second format you have to give value to search and the range. Value is searched in the
column of the given range and result is given from the same row but always from the last col
the range.
Syntax: LOOKUP(lookup_value, lookup_vector, [result_vector])
LOOKUP(lookup_value, array)
4. ROW():
Returns the row number of a reference.
Syntax: ROW([reference])
5. ROWS():
Returns the number of rows in a reference or array.
Syntax: ROWS(array)
6. COLUMN():
The COLUMN function returns the column number of the given cell reference. For example, th
formula =COLUMN(D10) returns 4, because column D is the fourth column.
Syntax: COLUMN([reference])
7. COLUMNS():
Returns the number of columns in an array or reference.
Syntax: COLUMNS(array)
8. INDEX():
Returns the value of an element in a table or an array, selected by the row and column numb
indexes.
Syntax: INDEX(array, row_num, [column_num])
INDEX(reference, row_num, [column_num], [area_num])
9. MATCH():
The MATCH function searches for a specified item in a range of cells, and then returns the rel
position of that item in the range. For example, if the range A1:A3 contains the values 5, 25, a
then the formula =MATCH(25,A1:A3,0) returns the number 2, because 25 is the second item
range.
Syntax: MATCH(lookup_value, lookup_array, [match_type])
Q1. The following worksheet displays the
Distance in Km
distance in kilometers.
Write the steps to find the train and bus fare
12
33
27
41
9
38
22
30 33 Train fare in Rs
58 64 Bus fare in Rs
43 48
67 71
17 19
58 64
43 48
17 30 43 58 67
19 33 48 64 71
10 DAYS 14 DAYS 40 67 71
135000 170000
Grade Basic HRA PF NET To know HRA for grade 'D'
A 1000 150 80 1070 450
D 3000 450 240 3210
B 4000 600 320 4280
C 5000 750 400 5350 To know PF for BASIC Salary of 3000
E 6000 900 480 6420 240
C D
Grade A D E
Basic 1000 4000 5000
HRA 150 600 750
PF 80 320 400
NET 1070 4280 5350
1 5 10
2 15 20
3 25 30
4 35 40
5 45 50
Name of the students and the marks scored by them in 3 different subjects are entered in the worksheet from A10 to cell
out of which the first row contains the column headings and the other rows contain the data. Find special average, result-1
result-2 in column E, F and G respectively. Give your own column headings for these three columns. Special Average: Sum
best 2 marks divided by 2. Result-1: A student is declared as "Pass' if he gets 35 or more marks in each subject otherwise 'F
Result-2: A student is declared as 'Pass' if he gets 40 or more marks in each subject and special average is 50 or more,
otherwise 'Fail'.
total
6
entered in the worksheet from A10 to cell D35
ntain the data. Find special average, result-1 &
hese three columns. Special Average: Sum of
or more marks in each subject otherwise 'Fail'.
ect and special average is 50 or more,
1 2
3
min 1.5
-1 5
Speacial Average By 3rd Method Result 1 Result 2
52.5 FAIL FAIL
74 PASS PASS
76 FAIL FAIL
63.5 FAIL FAIL
95 PASS PASS
79 FAIL FAIL
78 FAIL FAIL
59.5 FAIL FAIL
62 PASS PASS
63 FAIL FAIL
90.5 PASS PASS
51 FAIL FAIL
76 PASS FAIL
48 FAIL FAIL
61.5 FAIL FAIL
59 FAIL FAIL
65 PASS PASS
48 FAIL FAIL
81 FAIL FAIL
44 FAIL FAIL
66.5 FAIL FAIL
81 FAIL FAIL
76 PASS FAIL
59 FAIL FAIL
57.5 FAIL FAIL
5 4
2.5 2
Name & basic salary of 100 employees are entered in first two columns. The first row contains the column
headings calculate HRA, DA, MA, GROSS, PF & NET SALARY. HRA is 15% of basic salary or Rs. 200 whichever is
more. DA is 45% of basic salary subject to maximum of Rs. 1000. MA is 18.5% of basic salary subject to
maximum of Rs. 800 and subject to minimum of Rs.100. PF is 8.33% of basic salary if basic salary is above
2000 otherwise PF is NIL. Gross Basic salary + HRA +DA+MA & Net salary = Gross - PF. Net salary must be
rounded off to nearest ten.
PF NET SALARY
0 2680
0 3570
416.5 7130
376.6826 6620
481.8905 7970
833 12470
1249.5 17800
208.25 4130
1270.492 18070
0 670
2092.913 28600
833 12470
1249.5 17800
1666 23130
0 3570
0 2680
0 1840
212.8315 4200
5469.311 71840
4626.649 61050
0 1840
1878.582 25860
210.0826 4160
4600.243 60710
833 12470
Calculate income tax, surcharge and total tax for the following worksheet.
Income tax is calculated as follows:
AVG GRD
0C
35 B
45 B+
60 A
75 A+
90 A++
AVG GRD
0C
35 B
45 B+
60 A
75 A+
90 A++