Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
0% found this document useful (0 votes)
85 views

Excel INDIRECT Function Tutorial

Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
85 views

Excel INDIRECT Function Tutorial

Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 14

10/15/2016 Excel 

INDIRECT Function Tutorial

(http://www.contextures.com/index.html)

Excel INDIRECT Function


The INDIRECT function returns a reference to a range. You can use this function to create a reference
that won't change if row or columns are inserted in the worksheet. Or, use it to create a reference from
letters and numbers in other cells.

INDIRECT Function Arguments 

Lock a Cell Reference 

Video: INDIRECT Function

Create a Reference from a Cell Value 

Create a Reference from a Cell Value and Text 

Create a Reference to a Different Sheet 

Create a Reference to a Different Workbook 

Refer to a Named Range  

Dependent Data Validation Lists 

Download the Sample File

Vu 102cm 40 Ultra Hd 4k Smart Led...
₹ 36,990 ₹ 40,000 Great Offers on Televisions.
Flipkart

Thanks to Dave Peterson, for his contributions to this page.

INDIRECT Function Arguments


The INDIRECT function has two arguments:

1. ref_text: A cell reference or text string (or both), that create the range reference. The referenced
range can be a cell, a range of cells, or a named range.
2. a1: TRUE or FALSE. Does the reference use A1 reference style? If this argument is TRUE, or
omitted, the ref_text is A1 style. If the argument is FALSE, the ref_text is R1C1 style.

http://www.contextures.com/xlFunctions05.html 1/14
10/15/2016 Excel INDIRECT Function Tutorial

Note: If the INDIRECT formula refers to a different workbook, that workbook must be open, or the
formula will return a #REF! error.

Lock a Cell Reference


If you create a simple link to a cell, e.g. =A4, then insert a row above row 4, your formula will
automatically change to =A5. To prevent this change, you can use the INDIRECT function.

To demonstrate the difference, you'll create two formulas ­­ one that uses a simple link, and one that
uses a text string with an INDIRECT function.

1. In cell A4, type a number (10 in this example).
2. In cell B2, type the following formula: 
   =INDIRECT("A4")
3. Press the Enter key, and the formula will return the number in cell A4.
4. In cell C2, type the following formula: 
   =A4
5. Press the Enter key, and the formula will return the number in cell A4. 
6. To insert a row, right­click on the Row 4 button, and from the pop­up menu, choose Insert.
7. As shown below, cell B2, which uses the INDIRECT function, now returns 0, because cell A4 is
empty. The text string, "A4", in the INDIRECT formula did not change when the row was
inserted.
8. Cell C2, which contains the link, still returns 10, because its formula has changed to =A5.

Video: INDIRECT Function


To see the steps for creating a formula with the INDIRECT function, please watch this video tutorial.

http://www.contextures.com/xlFunctions05.html 2/14
10/15/2016 Excel INDIRECT Function Tutorial

Excel INDIRECT Function Gets ...

Create a Reference from a Cell Value


To create the ref_text argument, you can also refer to a cell, and use its contents. This makes the
formula more flexible, as its results will change, if the cell contents change.

In this example, you'll create formulas with the INDIRECT function, to compare the A1 and R1C1
reference styles.

1. In cells A1:A5, type a set of numbers, as shown below.

2. In cell C2, type:  A4
3. In cell C2, type:  R4C1
4. In cell D2, type the formula: =INDIRECT(C2)
5. Press the Enter key, and the formula returns the number in cell A4
6. In cell D3, type the formula: =INDIRECT(C3,FALSE)
7. The FALSE in the second argument indicates that the R1C1 reference style will be used.
8. Press the Enter key, and the formula returns the number in cell A4

Create a Reference from a Cell Value and


Text
To create the ref_text argument, you can combine text strings and cell references within an INDIRECT
function.

In this example, you'll create a formula with the INDIRECT function, using a number entered in a cell,
and a text string with the column letter.

http://www.contextures.com/xlFunctions05.html 3/14
10/15/2016 Excel INDIRECT Function Tutorial

1. In cells A1:A5, type a set of numbers, as shown below.

2. In cell C2, type the number 4.
3. In cell D2, type the formula: =INDIRECT("A"&C2)
4. Press the Enter key, and the formula returns the number in cell A4
5. Change the number in cell C2, and the result in D2 will change.

Note: If cell C2 is empty, the formula will return an error. To prevent this, you can add an IF function: 
     =IF(C2="",0,INDIRECT("A"&C2))

Create a Reference To a Di erent Sheet


An INDIRECT formula can also refer to cells on other worksheets. In this example, you'll create a
formula with the INDIRECT function, using references to a sheet name and cell name.

1. On a worksheet named Data Sheet, enter numbers in cells A1:A10
2. On a different sheet, in cell A2, enter the sheet name: Data Sheet
3. In cell B2, type a cell name from the range of numbers, e.g.: A2
4. In cell C2, type the following formula:
=INDIRECT("'" & A2 & "'!" & B2)

5. The first part of the string is a single quote within a set of double quotes:
     " ' "  (spaces were added for clarity)
6. After the reference to A2, which contains the sheet name, is a single quote and exclamation mark,
within a set of double quotes:
     " ' ! "  (spaces were added for clarity)
7. The string ends with a reference to cell B2, which contains the cell address.
8. Single quotes are included in the string to prevent errors if the sheet name contains space
characters. 
9. Press the Enter key, and the formula returns the number in cell A2 on the Data Sheet worksheet.
10. Change the number in cell C2, and the result in D2 will change.

Note: If either cell A2 or B2 is empty, the formula will return an error. To prevent this, you can add an
IF function:

    =IF(OR(A2="",B2=""),"",INDIRECT("'" & A2 & "'!" & B2))    

Create a Reference To a Di erent Workbook


http://www.contextures.com/xlFunctions05.html 4/14
10/15/2016 Excel INDIRECT Function Tutorial

Create a Reference To a Di erent Workbook


An INDIRECT formula can refer to cells in other workbooks, but will return a #REF! error if that
workbook is closed. In this example, you'll create a formula with the INDIRECT function, using
references to a file name, sheet name and cell name.

1. In an open file named TestFile.xls, on a worksheet named Test Data, enter numbers in cells
A1:A10
2. On a sheet in a different workbook, in cell A2, enter the file name: 
     Test File.xls
3. In cell A3, enter the sheet name: Test Data
4. In cell A4, type a cell name from the range of numbers, e.g.: A7

5. To see the syntax that you'll need to use in your formula, select cell A7, and type an equal sign:   =
6. Switch to Test File.xls, and click on cell A7
7. In the formula bar, you'll see the reference that was created:
       ='[Test File.xls]Test Data'!$A$7
8. You'll create an INDIRECT formula that uses the same syntax, adding the single quote marks,
square brackets and exclamation mark.
9. In cell A6, type the following formula:
=INDIRECT("'[" & A2 & "]" & A3 & "'!" & A4)
10. The first part of the string is a single quote and square bracket, within a set of double quotes:
     " ' [ "  (spaces were added for clarity)
11. After the reference to A2, which contains the file name, is a square bracket, within a set of double
quotes:
     " ] "  (spaces were added for clarity)
12. After the reference to A3, which contains the sheet name, is a single quote and exclamation mark,
within a set of double quotes:
     " ' ! "  (spaces were added for clarity)
13. The string ends with a reference to cell A4, which contains the cell address.
14. Single quotes are included in the string to prevent errors if the sheet name contains space
characters. 
15. Press the Enter key, and the formula returns the number in cell A7 on the Test Data worksheet, in
the Test File.xls workbook.
16. Change the values in cells A2:A5, and the result in A6 will change.
17. You can delete the sample link in cell A5

http://www.contextures.com/xlFunctions05.html 5/14
10/15/2016 Excel INDIRECT Function Tutorial

Note1: If A2, A3 or A4 is empty, the formula will return an error. To prevent this, you can add an IF
function:

     =IF(OR(A2="",A3="",A4=""),"",INDIRECT("'[" & A2 & "]" & A3 & "'!" & A4))

 Note2: If the Test File.xls workbook is closed, the above formula will return a #REF error. I haven't
used the following files, but they may help you if you need to pull data from a closed workbook:

Harlan Grove wrote a UDF called PULL that will retrieve the value from a closed workbook. You
can find the function at Harlan's download site:
http://www.4shared.com/file/L_eA8s4G/pull.html
(http://www.4shared.com/file/L_eA8s4G/pull.html)
Laurent Longre has an addin (morefunc.xll) at:
http://www.ozgrid.com/Services/ExternalFree.htm#MoreFunc
(http://www.ozgrid.com/Services/ExternalFree.htm#MoreFunc)
It includes =indirect.ext() that may help you.

Refer to a Named Range


In addition to cell references, you can refer to named ranges in an INDIRECT formula. In this example,
the INDIRECT function is used to sum the selected named range.

1. In cells A1:B5, type headings and numbers, as shown at right.
2. Name cells A2:A5 as East, and cells B2:B5 as West. There are naming instructions here:
Names ­­ Naming Ranges (xlNames01.html)

3. In cell D2, type the name of one of the ranges, e.g. East
4. In cell E2, type the formula: =SUM(INDIRECT(D2))
5. Press the Enter key, and the formula returns the sum of numbers in the East range.
6. Change cell D2 to West, and the formula returns the sum of numbers in the West range.

Dependent Data Validation Lists


The INDIRECT function can be used with Data Validation, to create dependent dropdown lists. For
example, select the Fruit category in column A, and the data validation list in column B shows a list of
Fruit options.

http://www.contextures.com/xlFunctions05.html 6/14
10/15/2016 Excel INDIRECT Function Tutorial

There are instructions for this technique here:  

Data Validation ­ Dependent Lists (xlDataVal02.html)

Download the Sample File


Download the sample INDIRECT workbook (Indirect.zip)

Related Pages
Functions List (functions.html)

INDIRECT ­ Compare Sheets (excelformulacheckcells.html)

30 Functions in 30 Days (30excelfunctionsin30days30xl30d.html)

AGGREGATE (http://blog.contextures.com/archives/2013/05/21/sum­a­filtered­list­with­aggregate­
function/)

AVERAGE (/excelaveragefunctions.html)

CHOOSE (/fiscalyearcalculations.html)

COUNT / COUNTIF (xlFunctions04.html)

HLOOKUP (/excelhlookupfunction.html)

HYPERLINK (http://www.contextures.com/excelhyperlinkfunction.html)

IF (/xlfunctions06_excel­if­function.html)

IFERROR (xlFunctions02.html#IFERROR)

INDEX / MATCH (xlFunctions03.html)

 Get Excel News

Name:

Email:

http://www.contextures.com/xlFunctions05.html 7/14
10/15/2016 Excel INDIRECT Function Tutorial

  Search
Custom Search

More Function Tutorials


INDIRECT ­ Compare Sheets (excelformulacheckcells.html)

Functions List (functions.html)

30 Functions in 30 Days (30excelfunctionsin30days30xl30d.html)

AGGREGATE (http://blog.contextures.com/archives/2013/05/21/sum­a­filtered­list­with­
aggregate­function/)

AVERAGE (/excelaveragefunctions.html)

CHOOSE (/fiscalyearcalculations.html)

COUNT / COUNTIF (xlFunctions04.html)

INDEX / MATCH (xlFunctions03.html)

MIN / MAX (excelminmaxfunction.html)

VLOOKUP (xlFunctions02.html)

http://www.contextures.com/xlFunctions05.html 8/14
10/15/2016 Excel INDIRECT Function Tutorial

 (30excelfunctionsin30days01.html)

Contextures
Excel News

Email:

Name (optional):

Get Started

http://www.contextures.com/xlFunctions05.html 9/14
10/15/2016 Excel INDIRECT Function Tutorial

(http://www.contextures.com/exceltoolsaddin.html)

http://www.contextures.com/xlFunctions05.html 10/14
10/15/2016 Excel INDIRECT Function Tutorial

(xlPivotPremAddIn.html)

 
http://www.contextures.com/xlFunctions05.html 11/14
10/15/2016 Excel INDIRECT Function Tutorial

http://www.contextures.com/xlFunctions05.html 12/14
10/15/2016 Excel INDIRECT Function Tutorial

(https://www.e­junkie.com/ecom/gb.php?cl=84674&c=ib&aff=70888)

http://www.contextures.com/xlFunctions05.html 13/14
10/15/2016 Excel INDIRECT Function Tutorial

(http://www.contextures.com/exceltoolsaddin.html)

Copyright © Contextures Inc. 2016

Privacy Policy (/privacy.html)

(https://mvp.microsoft.com/en­us/mvp/Debra%20%20Dalgleish­7612)Debra Dalgleish
(https://mvp.microsoft.com/en­us/mvp/Debra%20%20Dalgleish­7612)

Last updated: August 4, 2016 10:10 AM

http://www.contextures.com/xlFunctions05.html 14/14

You might also like