So strange! Why is my INDIRECT function returning 0 even though the formula should be 100% correct?

jvs411

New Member
Joined
Sep 18, 2023
Messages
27
Office Version
  1. 365
Platform
  1. Windows
I'm trying use INDIRECT into my formula but for some strange reason, it just doesn't work even though the alternative without INDIRECT does.
This is how my INDIRECT formula looks like (my sheet name is called "JAN HH")
1697679875026.png


The cell references:
1697679830638.png


And this is the sheet, "JAN HH", I'm trying to retrieve the value of 61 from column T
1697679939789.png


The funny thing is, if I removed my INDIRECT functions from the formula, it DOES work
1697680001457.png


So what's the issue here? I just doesn't seem to make sense at all to me.
It's worth noting also that the data in my "JAN HH" sheet is also linking to another external workbook using the INDIRECT function. Does this linkages have something to do with it? The linkage to the external workbook works fine though, as seen with all the values displayed.
 

Attachments

  • 1697679800048.png
    1697679800048.png
    6.3 KB · Views: 2

Excel Facts

Did you know Excel offers Filter by Selection?
Add the AutoFilter icon to the Quick Access Toolbar. Select a cell containing Apple, click AutoFilter, and you will get all rows with Apple
1697680286774.png


Also another strange thing is that my non-INDIRECT formula as seen above also displays as 0 if I first input the formula. I have to go into the formula bar and press enter again for the 61 to display...
 
Upvote 0
Try like this

jvs411.xlsm
CDE
1
2JAN61
3HH
4BD1
Sheet1
Cell Formulas
RangeFormula
E2E2=SUMIF(INDIRECT("'"&C2&" "&C3&"'!B:B"),""&C4&"",INDIRECT("'"&C2&" "&C3&"'!T:T"))
 
Upvote 0
Solution
Wow that worked! But...how?

I did a comparison between my formula and yours and it seems this red highlighted part is the main difference?
=SUMIF(INDIRECT("'"&C2&" "&C3&"'!B:B"),""&C4&"",INDIRECT("'"&C2&" "&C3&"'!T:T"))

Why is it when I typed this as INDIRECT(C4) instead, it doesn't work?
 
Upvote 0
Why is it when I typed this as INDIRECT(C4) instead, it doesn't work?
Because INDIRECT(C4) does not turn what is in C4 into a string as required, instead it says to go to cell BD1 and use the value there as the SUMIF condition.
If you go to cell BD1 on the formula sheet and enter DB1 there again, you would fine that formula with INDIRECT(C4) works.
However, turning BD1 into a string directly as I did is much more logical (and INDIRECT ;)).
 
Upvote 0
Because INDIRECT(C4) does not turn what is in C4 into a string as required, instead it says to go to cell BD1 and use the value there as the SUMIF condition.
If you go to cell BD1 on the formula sheet and enter DB1 there again, you would fine that formula with INDIRECT(C4) works.
However, turning BD1 into a string directly as I did is much more logical (and INDIRECT ;)).

Yeah I realized that now... Also seems I can just type C4 instead of ""&C4&"" to get the same result. Thanks for the help!
 
Upvote 0

Forum statistics

Threads
1,215,077
Messages
6,122,991
Members
449,094
Latest member
masterms

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