Solved

Array formula

Posted on 2013-12-02
9
601 Views
Last Modified: 2013-12-02
All,

A previous question I asked generated a following respons:

Contrary to his statement, ssaqibh's "ARRAY" formula doesn't need to be array-entered to give the correct answer:
=SUM(SUMIFS(Sheet2!$F:$F,Sheet2!$A:$A,{"11020","11030"}))

You could also write it as a SUMIF formula (doesn't need to be array-entered either):
=SUM(SUMIF(Sheet2!$A:$A,{"11020","11030"},Sheet2!$F:$F))

I applied the 1st formual and got my correct response I was shooting for.  I am now curious as to why the expert said this could be entered as an "array" as well, but did not need to, and what an array does for you as opposed to not applying "ctrl,alt,enter", and what is the application to know you need to apply this aspect before you hit the results of the formula.  I guess I'm just wanting a little education on "array formulas".  Are they written different in that they always use the {} symbols in the formula in some way?

Thanks,

Pete
0
Comment
Question by:pedwards3
  • 2
  • 2
  • 2
  • +3
9 Comments
 
LVL 4

Expert Comment

by:andrew_man
ID: 39689998
Some formulas are array formula.  You don't need to press the "ctrl,alt,enter"

Such as sumif, sumifs, sumproduct
0
 

Author Comment

by:pedwards3
ID: 39690009
when do you need to press "ctrl,alt,enter", and why?  What does it do for you, and what is the formula differences when writing?
0
 
LVL 4

Assisted Solution

by:andrew_man
andrew_man earned 100 total points
ID: 39690036
{=SUM(IF(Sheet1!$A:$A={"11020","11030"},Sheet1!$F:$F))}

If you want to use the non-array formula, you need to press "ctrl+alt+enter".  In my point of view, there are a lot of limitation and less flexibility in the array formula, but the array formula is faster than the non-array formula in running.  Therefore, you should select the array formula first (if possible).  

Andrew Man
0
 
LVL 32

Assisted Solution

by:Rob Henson
Rob Henson earned 100 total points
ID: 39690054
Consider this very simple formula:

=SUM(C4:C19)

Simple sum of values in range C4 to C19, however the entries in those cells are numbers with leading apostrophe making them text. Sum of text = 0.

A couple of options for converting the text into numbers so that they will be recognised in the SUM.

One option would be to put a formula in column =C4*1 and then SUM column D. Multiplying a text number by 1 forces Excel to recognise it as a number.

Consider this formula

=SUM(C4:C19*1)

As it stands it would generate an error.

However, confirm with Shift + Ctrl + Enter. In the formula bar it will then look like:

{=SUM(C4:C19*1)}

and it will work. The array setting tells excel to do the *1 to each cell in the array first.

So in summary, using an array formula tells excel to perform functions to individual cells rather than the range and then subsequent function on the result.

Another example, a column of text entries from which you want to find the length of the longest.

=LEN(TextCell) would give length of individual cell. =Max(LENFormulaRange) using range of LEN formulae would give max length:

{=MAX(LEN(TextCellsRange))} would give result in one hit.

Thanks
Rob H
0
Comprehensive Backup Solutions for Microsoft

Acronis protects the complete Microsoft technology stack: Windows Server, Windows PC, laptop and Surface data; Microsoft business applications; Microsoft Hyper-V; Azure VMs; Microsoft Windows Server 2016; Microsoft Exchange 2016 and SQL Server 2016.

 
LVL 85

Assisted Solution

by:Rory Archibald
Rory Archibald earned 100 total points
ID: 39690066
An array formula is almost always slower than a non-array formula.

As a rule, if the array part is an array constant - i.e. literal values between {} - then you do not have to enter the formula with Ctrl+Shift+Enter. If your {"11020","11030"} values were in two cells, you would have had to array-enter the formula.
0
 
LVL 43

Assisted Solution

by:Saqib Husain, Syed
Saqib Husain, Syed earned 100 total points
ID: 39690082
Contrary to his statement, ssaqibh's "ARRAY" formula doesn't need to be array-entered
That was because ssaqibh attempted it without array-entering but did not get the desired result (for some weird reason). And when ssaqibh tried array-entering it it gave the desired result. That is why ssaqibh gave that statement.

One of the rules is that if a normal formula gives the correct result then the same formula will give correct result if array-entered....I think.
0
 
LVL 32

Expert Comment

by:Rob Henson
ID: 39690119
As Rorya states, array formulas are slower.

I used to have a sheet in Excel 2003 in which I had envoked the Conditional Sum Wizard to create a table of Summary values based on multiple criteria, effectively a pivot table but I needed it to update with real time data rather than having to force the refresh each time.

The Conditional Sum Wizard created Array formulae using the =SUM(IF(...)) syntax and used to work but the sheet took AGES to recalculate. In other words the process looked at the IF and if required included the result in the SUM.

In later versions of Excel, I was able to convert it using SUMIFS and it recalc'd so much quicker.
0
 
LVL 23

Accepted Solution

by:
NBVC earned 100 total points
ID: 39690193
And further to Rory's statement about if you entered the values in 2 separate cells, then you would need to "array enter the formula".... well, you can override that too, by changing SUM to SUMPRODUCT..

e.g.

=SUM(SUMIF(Sheet2!$A:$A,F2:F5,Sheet2!$F:$F))  would need to be array-entered

but

=SUMPRODUCT(SUMIF(Sheet2!$A:$A,F2:F5,Sheet2!$F:$F))  would not need to be array entered.

Both giving same result....

SUMPRODUCT is really an array formula, but it's design doesn't require CSE confirmation.
0
 

Author Closing Comment

by:pedwards3
ID: 39690414
Clears things up tremendously gang.

Thanks for the class.  :-)

Pete
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

No matter the version of Windows you are using, you may have some problems with Windows Search running too slow or possibly not running at all. Before jumping into how you can solve this issue, just know there are many other viable alternative deskt…
My experience with Windows 10 over a one year period and suggestions for smooth operation
This Micro Tutorial will demonstrate how to use longer labels with horizontal bar charts instead of the vertical column chart.
Access reports are powerful and flexible. Learn how to create a query and then a grouped report using the wizard. Modify the report design after the wizard is done to make it look better. There will be another video to explain how to put the final p…

930 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

9 Experts available now in Live!

Get 1:1 Help Now