Dynamic array constants

michalrosa

New Member
Joined
Feb 18, 2010
Messages
7
Greeting all!
<?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" /><o:p> </o:p>
Is it possible to create a dynamic array constant? For example lets say we have the following array formula =if(type={A,B,C},if(category={X,Y,Z},if(mode=”No”,value)))
<o:p> </o:p>
It works fine with pre-defined, hard-coded array constants, is it possible to create them as dynamic entities, for example defined as a string in some cell and to point to that cell, something like =if(type=A1,if(category=A2,if(mode=”No”,value))) where A1 and A2 would be array constants.

Cheers,
Michal
 

Excel Facts

Enter current date or time
Ctrl+: enters current time. Ctrl+; enters current date. Use Ctrl+: Ctrl+; Enter for current date & time.
What are type, category, mode, A, B, C, X, Y, Z and value? Are they named ranges or labels.

You might try substituting the nested IF with an AND, perhaps arithemticaly expresses.
 
Upvote 0
OK, after fiddling with this for a bit, I think I understand your question.
The value of A1 can be only a number, text, logical or an error value.
A single cell cannot contain an array.
 
Upvote 0
OK, after fiddling with this for a bit, I think I understand your question.
The value of A1 can be only a number, text, logical or an error value.
A single cell cannot contain an array.

****, the solution I "found" does not actually work in my case - http://www.ozgrid.com/forum/showthread.php?t=46593, pity.<?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" /><o:p></o:p>
<o:p> </o:p>
Let's simplify:
<o:p> </o:p>
Cells A1:A3 contain values 5000,5001,5002 and are named “codes”, cells B1:B3 contain values 1000,2000,4000 and are named “values”.
<o:p> </o:p>
Formula =SUM(IF(codes={5000,5001},values)) returns 3000 as expected, what I would like to do is to use a dynamic name instead of an array constant, so far =SUM(IF(codes=A1:A2,values)) failed, so did =SUM(IF(codes=cbd,values)) – cbd being defined as a named range A1:A2.

Still no luck.

Cheers,
Michal
 
Upvote 0
I'm assuming that codes and values are named ranges. And that they are column-wise ranges (e.g. like B1:B10)

The explicit array {5000, 5001} is a row-wise explicit array

if you put 5000 in A1 and 5001 in A2

{=SUM(IF(codes=TRANSPOSE(A1:A2),values))} should work.
 
Upvote 0
I'm assuming that codes and values are named ranges. And that they are column-wise ranges (e.g. like B1:B10)

The explicit array {5000, 5001} is a row-wise explicit array

if you put 5000 in A1 and 5001 in A2

{=SUM(IF(codes=TRANSPOSE(A1:A2),values))} should work.

Doh, good one. I haven’t done any serious work with matrices for a while, of course the IF function would baulk when trying to compare two one-dimensional arrays of different sizes so transposing the second array does the trick.
<?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" /><o:p> </o:p>
Well done, thank you.
<o:p> </o:p>
Cheers,
<?xml:namespace prefix = st1 ns = "urn:schemas:contacts" /><st1:GivenName w:st="on">Michal</st1:GivenName>
 
Upvote 0

Forum statistics

Threads
1,223,250
Messages
6,171,036
Members
452,374
Latest member
keccles

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