Problem with Indirect function in an Array Formula

gassarma

New Member
Joined
Oct 13, 2011
Messages
7
Hi, i am trying use Indirect function in an array formula.
="{="&INDIRECT("J1")&"(IF((Sheet 1'!$B$2:$B$3761=$A9)*('Sheet 1'!$H$2:$H$3761=1)*('Sheet 1'!$J$2:$J$3761=1),'Sheet 1'!M$2:M$3761))}"
Where the cell J1 contains a cell dropdown with options such as product, average, min, max and the user can determine whether he wants an average or a product of the array forumla result. It is resulting in only the text. Can anyone please help.

Thanks
 

Excel Facts

Can a formula spear through sheets?
Use =SUM(January:December!E7) to sum E7 on all of the sheets from January through December
Andrew, thanks for the response. However, my formula is included in a cell and not in a macro. I dont know how to use FormulaArray property in the formla. is it possible?

Thanks
 
Upvote 0
Is this what you want?

=INDIRECT("J1")&IF(('Sheet 1'!$B$2:$B$3761=$A9)*('Sheet 1'!$H$2:$H$3761=1)*('Sheet 1'!$J$2:$J$3761=1),'Sheet 1'!M$2:M$3761)

confirmed with Ctrl+Shift+Enter. Excel will add the curly braces {}.
 
Upvote 0
Hi, i am trying use Indirect function in an array formula.
="{="&INDIRECT("J1")&"(IF((Sheet 1'!$B$2:$B$3761=$A9)*('Sheet 1'!$H$2:$H$3761=1)*('Sheet 1'!$J$2:$J$3761=1),'Sheet 1'!M$2:M$3761))}"
Where the cell J1 contains a cell dropdown with options such as product, average, min, max and the user can determine whether he wants an average or a product of the array forumla result. It is resulting in only the text. Can anyone please help.

Thanks
You can't evaluate a string of a function like MIN, MAX, or AVERAGE using cell formulas. Have you considered writing your own custom function in VBA?
 
Upvote 0
One way to do this is use the old Excel4 macro EVALUATE

Define a named range called FlexFormula, using this in the "refers to" box

=EVALUATE('Sheet 1'!$J$1&"(IF(('Sheet 1'!$B$2:$B$3761=$A9)*('Sheet 1'!$H$2:$H$3761=1)*('Sheet 1'!$J$2:$J$3761=1),'Sheet 1'!$M$2:$M$3761))")

Somewhere in the worksheet use this formula

=FlexFormula

and change J1 to the required function

[Note: when I tested the result updated if I changed the function in J1 but if I changed the data in the ranges it didn't update unless I re-entered the formula - I'm using Excel 2007, I don't know if it's peculiar to that version......]
 
Upvote 0
This formula yielded a result "Product 1.02". 1.02 being the result (only one) of the If condition. Where if condition more resulted in more than 1 data point, i am getting a '0'.
 
Upvote 0
Re: Problem with Indirect function in an Array Formula
<HR style="BACKGROUND-COLOR: #ffffff; COLOR: #ffffff" SIZE=1>Is this what you want?

=INDIRECT("J1")&IF(('Sheet 1'!$B$2:$B$3761=$A9)*('Sheet 1'!$H$2:$H$3761=1)*('Sheet 1'!$J$2:$J$3761=1),'Sheet 1'!M$2:M$3761)

confirmed with Ctrl+Shift+Enter. Excel will add the curly braces {}.

This formula yielded a result "Product 1.02". 1.02 being the result (only one) of the If condition. Where if condition more resulted in more than 1 data point, i am getting a '0'
 
Upvote 0

Forum statistics

Threads
1,216,117
Messages
6,128,936
Members
449,480
Latest member
yesitisasport

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