Indirect Explanation

Arts

Well-known Member
Joined
Sep 28, 2007
Messages
775
Office Version
  1. 365
  2. 2016
Platform
  1. Windows
Hi all

I have been trying to understand the INDIRECT concept but after hours of reading various web links and seeing examples I seemed to be more confused. If anyone could help shed some light on the questions I have that would be most appreciated. The issue I am having is not knowing when to use " " when referencing a cell.

From the below example if I need to attain the text East using the INDIRECT function I would need to wrap the I3 in quotations.

1672309784622.png



Now when I have named range "west" example below : when summing the numbers I am not clear as to why I do not need to wrap the D2 in "" so the formula in my mind should be =SUM(INDIRECT("D2")) as I need to retrieve the text "west" as I did with "East" above. But when the formula is entered this way this seems to not work but am following the rationale of attaining the text by using ""

Also when I type in west within the formula this is written as "west" : =SUM(INDIRECT("West")) but when referencing West if this was in a cell like East I would need to use (INDIRECT("D2") which would give me "West" as it did with East to attain the text but for what ever reason the formula needed is =SUM(INDIRECT(D2)) and not =SUM(INDIRECT("D2"))


1672309873379.png


Any help on this would be most helpful as when I am seeing multiple videos on this the first thing that is mentioned is that in order to attain the value in the as text we must use parenthesis.

And when watching video examples of Indirect formula being used with vlookup for example it seems when parenthesis should be used they aren't and vice versa.

If someone could break this down for me that would be very helpful.

Thanks

Arts
 
Happy to help. :)

Here's (yet) another way to look at it:

=INDIRECT("H2") is the equivalent of =H2.

If I put F2 in H2 and enter =H2 somewhere, you (hopefully) wouldn't be surprised that it returns the text F2, not the contents of cell F2.
 
Upvote 0

Excel Facts

Excel Wisdom
Using a mouse in Excel is the work equivalent of wearing a lanyard when you first get to college
Happy to help. :)

Here's (yet) another way to look at it:

=INDIRECT("H2") is the equivalent of =H2.

If I put F2 in H2 and enter =H2 somewhere, you (hopefully) wouldn't be surprised that it returns the text F2, not the contents of cell F2.

yeah that makes sense

How I was seeing it in my head was when you use the INDIRECT it need not be on the source cell (by this I mean F2 contains hello the "named range" for 4 where it is located in D2).

Now H2 may contain F2, in my head I was thinking where INDIRECT has returned "hello" this is the same as referencing hello from its original cell of F2 as hello is now showing as a value.

There was a bit way earlier (post 11 below) where you mentioned about calculation engine , the calculation engine already knows it is text referring to a named range and I just kinda ran with that to an extent, used INDIRECT(H2) this returned "hello" and it would have known this was relating to a named range.


If you put literal text in a formula directly, you have to enclose it in quotes. Otherwise Excel will assume it is either a function or a name. If you return text from a cell using a cell reference, it does not have to be in quotes because the calculation engine already knows it is text.

The C2 in INDIRECT(C2) is a direct cell reference and will be evaluated before anything else happens. Whatever is in C2 will then be passed to the INDIRECT function for it to evaluate as a range reference.
The "C2" in INDIRECT("C2") is simply text and so that formula will return whatever is in C2. Hence, =C2 and =INDIRECT("C2") are calculated exactly the same way.

It's no different if you are using the name of a range rather than a simple address. If you put it directly in the formula as literal text, it has to be in quotes:

=INDIRECT("Sales")

whereas if you have the word Sales in C2, you can use:

=INDIRECT(C2)

and both will return a reference to the range named Sales, which you can use in other functions like SUM.

If you used =INDIRECT(Sales), then Excel will evaluate the contents of the range named Sales and pass the result(s) to the INDIRECT function, which may or may not return an error depending on what is in the range.

progress has been made, I shall leave this thread/you alone for a while now, with out wearing it thin, thank you once again for all of your help on this.
 
Upvote 0
Glad to be of some help. :)

On the bright side, INDIRECT should generally be avoided anyway as it's a volatile function... ;)
 
Upvote 0
OK RoyA, Et Al, Let's take the INDIRECT ' and " placement... I had help developing this over in Indirect Syntax - Outside the workbook
I have crawled all over the internet, All I find is the Microsoft Answwers "Technically correct, but totally USELESS."

Until, I I found this post. The only discussion on why " are placed where they are and the results! =INDIRECT("H2") is the equivalent of =H2. Really, the discussion is a mind bender.

I am looking at F7. This formula works, The #REF! is there because I pulled it out and broke it for discussion purposes.

I want to develop Rules for " and ' in INDIRECT...
Excel Formula:
INDIRECT("'["&D6&"]"&E6&"'!$D:$D")

INDIRECT("'["&D6&"]"&E6&"'!$D:$D")

Why is the ' where it is? How do I develop a rule for placing it. (highlighted, colored, and bolded to point out the ' ) Also the placement & and "
Why the order? It is used in two place.


  • F5 formula is what I wanted to replace (15 work books, 160 tabs, Yes INDIRECT do not work when the files are closed that is because it is a volatile function, but it is the easiest way to develop one formula.)
  • F6 formula is the final formula I used in the spreadsheet, the formula give the correct info. It returns "No Source for PRICE" because it is referencing a file that is not open.
  • F7 formula is the INDIRECT for the purpose of this question, pulled out of F6
  1. a complete side question... Now that I have gotten to a formula that is serviceable (yet volatile). Is there a non-volatile formula that will do the same as F6 without retyping it in every cell? I now open the workbook the F6 is looking for. The volatile formula INDIRECT updates. I copy and paste the updated fields, close the file. Then rinse and repeat 15 more times.
I like the flexibility of INDIRECT, because I can build formulas using the content of cells. But I want the persistence of XLookUp. What I have in F6 is a serviceable work around for now.

Cell Formulas
RangeFormula
F5F5=XLOOKUP(B5,'S:\2025 Purchasing\2.SPREADSHEETS\[Cycle Count 1 (Floor) 2025.xlsm]ADORN'!$D:$D,'S:\2025 Purchasing\2.SPREADSHEETS\[Cycle Count 1 (Floor) 2025.xlsm]ADORN'!$F:$F)
F6F6=IF(ISERROR(XLOOKUP(B6,INDIRECT("'["&D6&"]"&E6&"'!$D:$D"),INDIRECT("'["&D6&"]"&E6&"'!$F:$F"),CONCAT("No price on ",E6))), "No Source for PRICE",XLOOKUP(B6,INDIRECT("'["&D6&"]"&E6&"'!$D:$D"),INDIRECT("'["&D6&"]"&E6&"'!$F:$F"),CONCAT("No price on ",E6)))
F7F7=INDIRECT("'["&D6&"]"&E6&"'!$D:$D")



Master - rework 2024.09.10.xlsx
ABCDEF
2FR #Vendor PNFile FolderFileTabVendor ID Cycle Count 1 (floor) 2025
3F100309670DT-SUPPORTUnkownUnkownUnkown
4F100270595540G2S:\2025 Purchasing\2.SPREADSHEETSCycle Count 1 (Floor) 2025360 Products
5F10050365045210765S:\2025 Purchasing\2.SPREADSHEETSCycle Count 1 (Floor) 2025.xlsxADORN23.21
6F10040503445210772S:\2025 Purchasing\2.SPREADSHEETSCycle Count 1 (Floor) 2025ADORNNo Source for PRICE
7F1003813312259-180S:\2025 Purchasing\2.SPREADSHEETSCycle Count 1 (Floor) 2025BOYD INDIANA#REF!
8F1002405482259-96S:\2025 Purchasing\2.SPREADSHEETSCycle Count 1 (Floor) 2025BOYD INDIANA
9F1000668523840RBKS:\2025 Purchasing\2.SPREADSHEETSCycle Count 1 (Floor) 2025D & W
10F1004245563940BKS:\2025 Purchasing\2.SPREADSHEETSCycle Count 1 (Floor) 2025D & W
11F1003492553U115S:\2025 Purchasing\2.SPREADSHEETSCycle Count 1 (Floor) 2025H.B FULLER
12F1003182393U316S:\2025 Purchasing\2.SPREADSHEETSCycle Count 1 (Floor) 2025H.B FULLER
13F100349578AERO 5324PS:\2025 Purchasing\2.SPREADSHEETSCycle Count 1 (Floor) 2025HAHN SYSTEMS, LLC
14F100358023AEROSMITH 5323HPSTS:\2025 Purchasing\2.SPREADSHEETSCycle Count 1 (Floor) 2025HAHN SYSTEMS, LLC
Sheet4 (2)
 
Upvote 0

Forum statistics

Threads
1,223,912
Messages
6,175,340
Members
452,638
Latest member
Oluwabukunmi

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top