0% found this document useful (0 votes)
18 views7 pages

Practical No.1

Uploaded by

aaditya31977
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
18 views7 pages

Practical No.1

Uploaded by

aaditya31977
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd

FIRST YR B. TECH SEM-I PRACTICAL NO.

1 MANUAL COMPUTER WORKSHOP-I LAB (25CS01PR0102)

Practical Aim: Suppose you manage a sales department and have a dataset containing sales
data, including salespersons, products, sales amount, and the date of sales.
a. Find the sales amount for a specific salesperson and product with INDEX-MATCH.
b. Calculate the total sales for each salesperson using an array formula.

Array Formula
Array formulas in Excel allow you to perform multiple calculations on one or more items in
an array. They are powerful tools for data analysis, capable of returning either single result
(single-cell array formulas) or multiple results (multi-cell array formulas). Array formulas
are also known as CSE (Ctrl+Shift+Enter) formulas because you press Ctrl+Shift+Enter to
enter them. Below is an overview of the syntax for array formulas:

Single-Cell Array Formula

A single-cell array formula returns a single value based on multiple calculations.

Syntax:

{=formula(array)}

Example

Suppose you have two columns of numbers, A1:A3 and B1:B3, and you want to calculate
the sum of the products of corresponding elements in these two arrays.
• Data:

A B

1 2

3 4

5 6

• Array Formula:

{=SUM(A1:A3 * B1:B3)}

• Steps:

1. Enter the formula =SUM(A1:A3 * B1:B3) in a cell.

2. Press Ctrl + Shift + Enter to make it an array formula. Excel will automatically
add the curly braces {} around the formula.

• Result: The formula calculates (1*2) + (3*4) + (5*6), returning 44.

1
FIRST YR B. TECH SEM-I PRACTICAL NO.1 MANUAL COMPUTER WORKSHOP-I LAB (25CS01PR0102)

Multi-Cell Array Formula

A multi-cell array formula returns multiple values and fills several cells with results.

Syntax:

{=formula(array)}

Example

You want to calculate the products of corresponding elements in two arrays A1:A3 and
B1:B3, and display each result in a different cell.
• Data:

A B

1 2

3 4

5 6

• Array Formula:

{=A1:A3 * B1:B3}

• Steps:

1. Select a range of cells where you want the results to appear (e.g., C1:C3).

2. Type the formula =A1:A3 * B1:B3.

3. Press Ctrl + Shift + Enter to make it an array formula.

• Result:

12

30

• The cells C1:C3 will display 2, 12, and 30, corresponding to the products 1*2, 3*4, and
5*6.

2
FIRST YR B. TECH SEM-I PRACTICAL NO.1 MANUAL COMPUTER WORKSHOP-I LAB (25CS01PR0102)

Array Constants

Array constants are a set of static values that you can use in an array formula.

Syntax:

{=SUM(A1:A3 * {1,2,3})}

• This array constant {1,2,3} will be multiplied element-wise with A1:A3, and the sum of
those products will be returned.

Key Points:

• Entering Array Formulas:

o Array formulas must be entered by pressing Ctrl + Shift + Enter instead of just
Enter.

o Excel will automatically add curly braces {} around the formula to indicate it’s
an array formula. Do not type the braces manually.

• Single vs. Multi-Cell:

o Single-cell array formulas return one result and are entered in a single cell.

o Multi-cell array formulas return multiple results and must be entered in a range of
cells.

• Array Constants:

o Array constants can be used in array formulas and are enclosed in {}.

o Row values are separated by commas (,), and column values by semicolons (;).

3
FIRST YR B. TECH SEM-I PRACTICAL NO.1 MANUAL COMPUTER WORKSHOP-I LAB (25CS01PR0102)

INDEX-MATCH Functions

The INDEX and MATCH functions in Excel are often used together to perform more
advanced lookups than what is possible with the VLOOKUP or HLOOKUP functions alone.

INDEX Function

The INDEX function returns the value of an element in a table or array, selected by the row
And column number indexes.
Syntax:

INDEX(array, row_num, [column_num])

• array: A range of cells or an array constant.

• row_num: The row number in the array from which to return a value.

• column_num: (Optional) The column number in the array from which to return a value.
If omitted, INDEX will return the value in the row specified by row_num.

MATCH Function

The MATCH function searches for a specified value in a range of cells and returns the
relative position of that item.

Syntax:

MATCH(lookup_value, lookup_array, [match_type])

• lookup_value: The value you want to search for in the lookup_array.

• lookup_array: The range of cells being searched.

• match_type: (Optional) The number -1, 0, or 1. Specifies how Excel matches the
lookup_value with values in lookup_array.

o 1 or omitted: Finds the largest value that is less than or equal to the lookup_value.
The lookup_array must be in ascending order.

o 0: Finds the first value that is exactly equal to the lookup_value. The lookup_array
can be in any order.

o -1: Finds the smallest value that is greater than or equal to the lookup_value. The
lookup_array must be in descending order.

4
FIRST YR B. TECH SEM-I PRACTICAL NO.1 MANUAL COMPUTER WORKSHOP-I LAB (25CS01PR0102)

Combining INDEX and MATCH

When combined, the MATCH function is used to find the row and/or column number for
the INDEX function to return the value from the array.

Syntax for one-dimensional array:

INDEX(array, MATCH(lookup_value, lookup_array, [match_type]), [column_num])

Example 1: Using INDEX-MATCH with Multiple Criteria

Data

Name Product Sales

John Product A 500

Jane Product B 700

Mike Product A 300

John Product B 600

Jane Product A 800

Mike Product B 400

Find the sales amount for "John" with "Product B".

1. Find the Row Number: Use MATCH to find the row number where both conditions are
met:

MATCH(1, (A2:A7="John")*(B2:B7="Product B"), 0)

Since this is an array formula, press Ctrl + Shift + Enter.

2. Find the Sales Amount: Use INDEX to find the corresponding sales amount:

=INDEX(C2:C7, MATCH(1, (A2:A7="John")*(B2:B7="Product B"), 0))

Again, since this is an array formula, press Ctrl + Shift + Enter.

Full Formula

=INDEX(C2:C7, MATCH(1, (A2:A7="John")*(B2:B7="Product B"), 0))

5
FIRST YR B. TECH SEM-I PRACTICAL NO.1 MANUAL COMPUTER WORKSHOP-I LAB (25CS01PR0102)

Explanation

• MATCH(1, (A2:A7="John")*(B2:B7="Product B"), 0):

o Creates an array of 1 and 0 values, where each element is 1 if both conditions are
true, otherwise 0.

o Finds the position (relative row number) of the first 1 in the array.

• INDEX(C2:C7, ...):

o Uses the row number from the MATCH function to return the value from the Sales
Amount column.

Example 2: Array Formula to Calculate Total Sales by Product

Calculate the total sales for Product A.

Steps

1. Define the Data Range:

o Salespersons and products are in A2:B7.

o Sales amounts are in C2:C7.

2. Write the Array Formula:

o Use SUM with IF to conditionally sum the sales amounts for Product A.

=SUM(IF(B2:B7="Product A", C2:C7))

3. Enter the Array Formula:

o Press Ctrl + Shift + Enter to enter the formula as an array formula.

Result

The formula will return 1600, which is the total sales for Product A.

Syntax for two-dimensional arrays:


INDEX(array, MATCH(row_lookup_value, row_lookup_array, [match_type]), MATCH(column_lookup_value,
column_lookup_array, [match_type]))

Example 3: Using INDEX-MATCH to Find Data in a 2D Array

You have a table of students' scores in different subjects, and you want to find the score of
as specific student in a specific subject.

6
FIRST YR B. TECH SEM-I PRACTICAL NO.1 MANUAL COMPUTER WORKSHOP-I LAB (25CS01PR0102)

Data

Student Math English Science

Rajat 85 90 88

Mona 78 82 89

Raman 92 87 91

Neha 80 85 84

Find Mona's score in Science.

Steps

1. Define the Data Range:

o Students' names are in A2:A5.

o Subjects (scores) are in B2:D5.

2. Write the Formula:

o Use MATCH to find the row for Mona and the column for Science.

o Use INDEX to return the corresponding score.

=INDEX(B2:D5, MATCH("Mona", A2:A5, 0), MATCH("Science", B1:D1, 0))

Result

The formula will return 89, which is Mona's score in Science.

Conclusion
By mastering array formulas, we can perform complex calculations more efficiently and
leverage Excel’s full potential for data analysis. By understanding and practicing this syntax,
we can use INDEX and MATCH together to perform powerful and flexible lookups in Excel.

You might also like