Simple Dynamic Array Formula Question

RICH937

Board Regular
Joined
Apr 15, 2023
Messages
53
Office Version
  1. 365
Platform
  1. Windows
  2. Mobile
I'm a Dynamic Array newbie, and this question is more about formula structure than needing help. I have a dynamic array (DK4#) that I wanted to sum the values entered in the 4th column. Based on my understanding of new/old dynamic array formulas, these two formulas should produce the same results:

SUMIFS(CHOOSECOLS(DK4#,4),CHOOSECOLS(DK4#,1),DK4)
SUMIFS(INDEX(DK4#,,4),INDEX(DK4#,,1),DK4)

However, the first formula returns an error (value#), but the second works fine. Anyone know what makes excel see them as different?
 

Excel Facts

Does the VLOOKUP table have to be sorted?
No! when you are using an exact match, the VLOOKUP table can be in any order. Best-selling items at the top is actually the best.
Index returns a Range object although most people only ever use the value in the range being returned.
(Note: XLookup also returns a Range Object although normally in common use only a single cell)
In VBA you could use Index or XLookup to get the address of what they find)
ChooseCols return an array and not a range.

Why that is important is because SumIfs will only work with Ranges and not Arrays.
So it is fine with Index but won't handle an ChooseCols (or any other array formula).

1685187979125.png

Just to see what it can look like

1685188253268.png
 
Upvote 0
Solution
If you want to use ChooseCols then you could use this instead:
Excel Formula:
SUM(CHOOSECOLS(DK4#,4) * (CHOOSECOLS(DK4#,1) = DK4))
 
Upvote 0
This is so much simplier. Brilliant. Thank you. What is frustrating is while there's a TON of vids on YouTube and excel sites online, there is a wealth of info on using both new/old formulas with data arrays (as well as tables/ranges). Nearly nothing on applying those formulas using the hash (#) references. A lot of them work the same in both, but not all. When linking analysis to a data array drawing from a table, database, or other source that is updated, not using "#" means one can easily end up with formulas that contain way too many calculations for Excel to handle efficiently....or at all. It's crazy frustrating when a formula using A:C or $A$1:$C$50000 works fine, but A1# returns a #VALUE! error.
 
Upvote 0
I know that your question was about why a particular formula did not work, and Alex has answered that, but another way with CHOOSECOLS would be
Excel Formula:
=SUM(IF(CHOOSECOLS(DK4#,1)=DK4,CHOOSECOLS(DK4#,4)))
 
Upvote 1

Forum statistics

Threads
1,214,606
Messages
6,120,485
Members
448,967
Latest member
visheshkotha

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