Lookup Functions in Excel
Lookup Functions in Excel
In this guide, you will learn how to work with lookup functions in Microsoft
Excel 2019. This guide will help you to perform tasks like working with arrays
of data, providing information about a range, returning the location of a given
address or value, or looking up specific values.
There are a number of various lookup functions in Excel 2019:
ADDRESS Function
AREAS Function
UNIQUE Function
CHOOSE Function
COLUMN Function
COLUMNS Function
INDEX Function
MATCH Function
VLOOKUP Function
HLOOKUP Function
LOOKUP Function
ADDRESS Function
The ADDRESS function gives us the address for a cell based on the given row
and column numbers.
The ADDRESS function has the following syntax:
1
=ADDRESS(row_num, column_num, [abs_num], [a1],
[sheet_text])
The arguments used in this function include:
Let us consider a scenario in which you can implement the ADDRESS function.
Consider the example below.
A B C D E F G H
Sr. Row_Nu Column_Nu Abs_Nu A Sheet_tex Address Formula Resul
No m m m 1 t t
.
1 1 4 =ADDRESS(B1, C1) ?
2 3 5 1 =ADDRESS(B2,C2,D ?
2)
3 2 1 2 1 =ADDRESS(B3, C3, ?
D3, E3)
4 7 11 3 0 sheet1 =ADDRESS(B4, C4, ?
D4, E4, F4)
5 18 12 4 1 =ADDRESS(B5, C5, ?
D5, E5)
The result will be updated as shown below:
A B C D E F G H
Sr. Row_Nu Column_Nu Abs_Nu A Sheet_te Address Formula Result
No m m m 1 xt
.
1 1 4 =ADDRESS(B1, $D$1
C1)
2 3 5 1 =ADDRESS(B2,C2, $E$3
D2)
3 2 1 2 1 =ADDRESS(B3, A$2
C3, D3, E3)
4 7 11 3 0 sheet1 =ADDRESS(B4, sheet1!
C4, D4, E4, F4) R7C11
5 18 12 4 1 =ADDRESS(B5, L18
C5, D5, E5)
AREAS Function
The AREAS function gives the number of areas in a given reference where an
area is a range of contiguous cells or a single cell.
It has the following syntax:
1
=AREAS(reference)
The argument used in this function is:
Let’s consider a scenario in which you can implement the AREAS function.
Consider the example below.
A B C D E F G H
Sr. Row_Num Column_Num Abs_Nu A1 Sheet_text AREA Formula Result
No. m
1 1 4 =AREAS(B1:C1) ?
2 3 5 1 =AREAS(B2:C2, ?
D2)
3 2 1 2 1 =AREAS(B3:E3) ?
4 7 11 3 0 sheet1 =AREAS(B4:D4, ?
E4, F4)
5 18 12 4 1 =AREAS(B5:C5 ?
B5)
The result will be updated as shown below:
A B C D E F G H
Sr. Row_Num Column_Num Abs_Nu A1 Sheet_text AREA Formula Result
No. m
1 1 4 =AREAS(B1:C1) 1
2 3 5 1 =AREAS(B2:C2, 2
D2)
3 2 1 2 1 =AREAS(B3:E3) 1
4 7 11 3 0 sheet1 =AREAS(B4:D4, 3
E4, F4)
5 18 12 4 1 =AREAS(B5:C5 1
B5)
UNIQUE Function
The UNIQUE function returns unique values from a list of values.
It has the following syntax:
1
=UNIQUE(range)
Consider the scenario below in which you have a few values in different rows:
A B C
SR. VALUE UNIQUE VALUES
NO.
1 15
2 18
3 15
4 16
5 18
You can apply the =UNIQUE(B1:B5) function to get the unique values from the
given list of values. The output will be as shown below:
A B C
SR. VALUE UNIQUE VALUES
NO.
1 15 15
2 18 16
3 15 18
4 16
5 18
CHOOSE Function
The CHOOSE function uses index_num to return a value from the list of value
arguments.
It has the following syntax:
1
=CHOOSE(index_num, value1, [value2], ...)
The arguments used in this function include:
index_num = Required, specifies the selected value argument. This
argument must be a number that lies between 1 and 254 or a formula or
reference to a cell containing a number between 1 and 254.
Value1, value2, ... = Value1 is a Required argument, whereas
subsequent values are Optional arguments.
Let’s consider an example.
A B C
SR. Function Output
NO.
1 =CHOOSE(4,"Monday", "Tuesday", "Wednesday", "Thursday", "Friday") ?
2 =CHOOSE(2, 2, "Cat", 23, 321, "ABC") ?
3 =CHOOSE(1,34,323,3221,1221) ?
The result will be updated as shown below:
A B C
SR. Function Output
NO.
1 =CHOOSE(4,"Monday", "Tuesday", "Wednesday", "Thursday", Thursday
"Friday")
2 =CHOOSE(2, 2, "Cat", 23, 321, "ABC") Cat
3 =CHOOSE(1,34,323,3221,1221) 34
array = Required,
a range of cells or an array constant.
row_num = Required, selects the row in an array from which to return a
value. In case the row_num is omitted, column_num is Required.
column_num = Optional, selects the column in array from which to return a
value. In case column_num is omitted, row_num is Required.
MATCH Function
The MATCH function searches a specific item in a range of cells, and returns the
relative position of that item in the given range. It has the following syntax:
1
=MATCH(lookup_value, lookup_array, [match_type])
The arguments used in this function include:
Match_type Behavior
It finds the largest value that is less than or equal to lookup_value . The values in
1 or
the lookup_array argument must be placed in ascending order, for example: ...-2,
omitted
-1, 0, 1, 2, ..., A-Z, FALSE, TRUE.
It finds the first value that is exactly equal to lookup_value . The values in
0
the lookup_array argument can be in any order
It finds the smallest value that is greater than or equal to lookup_value . The values
-1 in the lookup_array argument must be placed in descending order, for example:
TRUE, FALSE, Z-A, ...2, 1, 0, -1, -2, ..., and so on.
Consider the example below.
A B C D E F
SR. MARK
NAME GRADE FUNCTION OUTPUT
NO. S
1 ALISHA 35 F =MATCH("BEN", B1:B5, 0) ?
2 CATHY 75 D =MATCH(94, C1:C5, 1) ?
3 BEN 78 C =MATCH("F", D1:D5, -1 ) ?
4 ELE 94 B =MATCH("A", D1:D5, -1 ) ?
5 DRAKE 95 A =MATCH("ELE", B1:B5, 0) ?
The result will be updated as shown below:
A B C D E F
SR. MARK GRAD OUTPU
NAME FUNCTION
NO. S E T
ALISH =MATCH("BEN", B1:B5,
1 35 F 3
A 0)
2 CATHY 75 D =MATCH(94, C1:C5, 1) 4
3 BEN 78 C =MATCH("F", D1:D5, -1 ) 1
4 ELE 94 B =MATCH("A", D1:D5, -1 ) 5
A B C D E F
=MATCH("ELE", B1:B5,
5 DRAKE 95 A 4
0)
VLOOKUP Function
You can use VLOOKUP function when you need to find values in a table or a
range by row. The VLOOKUP function has the following syntax:
1
=VLOOKUP(lookup value, table_array, col_index_num,
[range_lookup])
The arguments used in this function include:
lookup value = Required, the value that you want to look up.
table_array = Required, the range where the lookup value is
located. lookup value should always be in the first column in
the table_array for VLOOKUP function to work correctly.
col_index_num = Required, the column number in the table_array that
contains the return value of the function.
range_lookup = Optional, its value is TRUE if you want an approximate
match of the return value or FALSE if you want an exact match. The
default value for this argument is TRUE .
Let’s consider a scenario where you can implement the VLOOKUP function. Say
you have a database that contains information for all teachers in a class, as
below:
If you wanted to know the D.O.B. for ID = 116 , you would write
the =vlookup(116,A2:E11,5,0) function and get the output 12-Aug-92 , as shown
below:
HLOOKUP Function
The HLOOKUP function works in a similar manner as the VLOOKUP function. It’s
short for Horizontal LOOKUP , and it searches for a value in the top row of a
given table or an array of values, then returns a value in the same column
from a row you specify in the table or array. The HLOOKUP function has the
following syntax:
1
=HLOOKUP(lookup_value, table_array, row_index_num,
[range_lookup])
Consider once again the database of information on a group of teachers.:
LOOKUP Function
The LOOKUP function can be used when you need to look in a single row or
column and find a value in the same position in a second row or column.
The LOOKUP function has the following syntax:
1
=LOOKUP(lookup_value, lookup_vector, [result_vector])
The arguments used in this function include:
Conclusion
In this guide, you've learned various LOOKUP functions in MS Excel 2019.
They can be used to automatically perform many operations and tasks that
are otherwise time-consuming and prone to mistakes, such as working with
arrays of data. Now you can explore by using these Excel features in your
daily work.
Introduction
In this guide, you will learn how to work with logical functions in Microsoft
Excel 2019. There are various logical functions which are present in the Excel
2019 version, as mentioned below:
TRUE
FALSE
OR
AND
NOT
XOR
IF
IFERROR
IFNA
IFS
SWITCH
Logical Functions
In this section, you will learn about each of these logical functions through
various scenarios.
The TRUE and FALSE Functions
We use the TRUE and FALSE functions when we want to showcase if a given
condition is met or not. For instance, 5 < 3 is a correct condition, hence
the TRUE function when used with the IF function (or any other function)
returns a TRUE value. Had the condition been wrong, it would had resulted in
the FALSE value.
Notice that the TRUE function is not the same as the TRUE value.
The TRUE function doesn't hold any argument inside the round brackets.
The OR Function
A logical OR function follows the given truth table:
Input A Input B Input C Output
0 0 0 0
0 0 1 1
0 1 0 1
0 1 1 1
Input A Input B Input C Output
1 0 0 1
1 0 1 1
1 1 0 1
1 1 1 1
In the above table, you can also consider 0 as a FALSE value and 1 as
a TRUE value. As you can observe if any input has a TRUE value then the output
of the logical OR function is TRUE . However, if all the inputs are FALSE then the
output becomes FALSE .
Let us consider a scenario where you can learn how to implement the
logical OR function in Excel. We take five students attendance who have
registered for a workshop. The final attendance is marked only when student
is present any one of the days. Here's the data:
A B C D E
FALS
5 Student 5 FALSE FALSE ?
E
So, to fill the attendance, we provide the following logical OR formula with
syntax:
1
=OR(logical1, logical2, ... )
Therefore, let us put the formula =OR(B1, C1, D1) in cell E1 and then apply it in
subsequent rows. This will result in the updated attendance as shown:
A B C D E
FALS
5 Student 5 FALSE FALSE FALSE
E
0 0 0 0
0 0 1 0
0 1 0 0
0 1 1 0
1 0 0 0
1 0 1 0
1 1 0 0
1 1 1 1
FALS
5 Student 5 FALSE FALSE FALSE
E
TRUE FALSE
FALS
TRUE
E
As you can observe from the table, the NOT function inverts a given logical
input. Let us take a scenario to understand how to use it in Excel.
You have a data of people preferences which even includes their Veg and Non-
Veg type inputs, as shown in the table below. How can you select people who
are Non-Veg ?
A B
1 Veg ?
2 Non-Veg ?
1 Veg FALSE
A B
2 Non-Veg TRUE
0 0 0 0
0 0 1 1
0 1 0 1
0 1 1 0
1 0 0 1
1 0 1 0
1 1 0 0
1 1 1 1
To understand the above table, consider two inputs at a time. If there is the
same value in both inputs then the result is FALSE (or 0 ). Next, use this result
of the first two inputs, then take the third input and perform the same action.
To illustrate this, let us take the last row which has 1 for all the inputs. Here,
Input A and B has 1 and 1 respectively which gives 0 . Now, combine
this 0 and Input C ( 1 ). As you can observe, this time you have different values;
hence, the output is 1 .
To illustrate this in Excel, let us consider an example where a child is
presented with three different food items. At one time, she is given a choice
between two food items and she can't choose both. Once the choice from the
first two is made then the third item is presented for a final choice.
A B C D
The IF Function
The logical IF function checks for a given condition. If the condition
holds TRUE , the first argument after the condition argument is returned or else
the second argument after the condition argument is returned.
The syntax of the IF function in Excel is given below:
1
=IF(condition, true value, false value)
Consider a case where you are provided with the data of students’ marks. You
need to mark a student as failed if their total marks are less than, or equal to,
150 out of 500.
A B
1 425 ?
2 125 ?
3 325 ?
4 441 ?
5 87 ?
6 222 ?
This can be achieved by using the logical IF function. You can write the given
formula =IF(A1 <= 150, "FAIL", "PASS") in the cell B1 and apply the formula in
the subsequent rows to achieve the following result:
A B
1 425 PASS
2 125 FAIL
3 325 PASS
4 441 PASS
5 87 FAIL
6 222 PASS
Input
Input B Output
A
1 54 23 ?
2 21 45 ?
3 789 2 ?
4 98 0 ?
5 451 584 ?
6 65 12 ?
To solve this problem, we can use the IFERROR function by writing its formula in
cell C1 as =IFERROR(A1/B1, 10) which results in the following table:
A B C
Input Input
Output
A B
1 54 23 2.347826087
2 21 45 0.466666667
3 789 2 394.5
4 98 0 10
6 65 12 5.416666667
Inpu
Output
t
1 #N/A ?
2 ?
3 #N/A ?
40 ?
5 584 ?
6 12 ?
You can implement the formula =IFNA(A1, "NULL value") in the cell B1 to get
the following output. Let’s observe the output for cell B2 .
A B
Inpu
Output
t
2 0
40 0
5 584 584
6 12 12
Conclusion
In this guide, you have learned about the various logical functions available in
MS Excel 2019 like TRUE , IF , OR , NOT , etc.