Unique and Indirect Functions

jwaz73

New Member
Joined
Oct 19, 2022
Messages
8
Office Version
  1. 365
Platform
  1. MacOS
Hello Friends! I'm new to using what I believe are called dynamic functions in Excel. I have successfully used the INDIRECT function in this same sheet like this:
Excel Formula:
=SUMPRODUCT(SUMIF(INDIRECT("'"&tblSheets&"'!AG7:AG26"),K7,INDIRECT("'"&tblSheets&"'!AW7:AW26")))
Obviously, this will return a numeric value.

Now, trying to get a unique list of text like this:
Excel Formula:
=UNIQUE(INDIRECT("'"&tblSheets&"'!AG31:AJ40"))
This results in a #VALUE! error with the details stating "A value used in the formula is of the wrong data type."

What I'm expecting is to get multiple results that 'spill' into the cells below the formula cell.

The format of all cells involved is 'General'. (If that makes any difference.)

What I'm trying to accomplish here is to account for sheets being added to this worksheet, then the tblSheets named range can be adjusted without having to rewrite several formulas.

I'm about five hours into reading about how to use the two functions in this formula and haven't made any progress. Suggestions are appreciated.

-Many Thanks!!
 

Excel Facts

Save Often
If you start asking yourself if now is a good time to save your Excel workbook, the answer is Yes
try this
Excel Formula:
=UNIQUE(INDIRECT("'"&"tblSheets"&"'!"&"AG31:AJ40"))
 
Upvote 0
MrExcel has a tool called “XL2BB” that lets you post samples of your data that will allow us to copy/paste it to our Excel spreadsheets, so we can work with the same copy of data that you are. Instructions on using this tool can be found here: XL2BB Add-in
 
Upvote 0
I don't think you can use unique & indirect like. Do you have the VSTACK function yet?
 
Upvote 0
try this
Excel Formula:
=TOCOL(INDIRECT("'"&"tblSheets"&"'!"&"AG31:Aj40"))
 
Upvote 0
@ExceLoki I suspect that tblSheets is a named range not a sheet name.
 
Upvote 0
Thank you, both! Let me explore the VSTACK function and if needed I'll post some sample data.
 
Upvote 0
So, yes. I can use the VSTACK function in a formula. Looking at the docs for VSTACK I see it accepts only an array of cell ranges. Haven't tried anything yet.

Is there a better way to handle a dynamic range of worksheets other than the INDIRECT function? @Fluff was correct, I am using the named range 'tblSheets' as a list of the worksheets to include in the formula.
 
Upvote 0

Forum statistics

Threads
1,215,005
Messages
6,122,661
Members
449,091
Latest member
peppernaut

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