Solved

Array formula

Posted on 2013-12-02
9
632 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:Pete Edwards
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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:Pete Edwards
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
 Database Backup and Recovery Best Practices

Join Percona’s, Architect, Manjot Singh as he presents Database Backup and Recovery Best Practices (with a Focus on MySQL) on Thursday, July 27, 2017 at 11:00 am PDT / 2:00 pm EDT (UTC-7). In the case of a failure, do you know how long it will take to restore your database?

 
LVL 33

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
 
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 33

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:Pete Edwards
ID: 39690414
Clears things up tremendously gang.

Thanks for the class.  :-)

Pete
0

Featured Post

Migrating Your Company's PCs

To keep pace with competitors, businesses must keep employees productive, and that means providing them with the latest technology. This document provides the tips and tricks you need to help you migrate an outdated PC fleet to new desktops, laptops, and tablets.

Question has a verified solution.

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

Ever visit a website where you spotted a really cool looking Font, yet couldn't figure out which font family it belonged to, or how to get a copy of it for your own use? This article explains the process of doing exactly that, as well as showing how…
If you need to forecast numbers -- typically for finance -- the Windows and Mac versions of Excel 2016 have a basket of tools to get the job done.
This Micro Tutorial will demonstrate on a Mac how to change the sort order for chart legend values and decrpyt the intimidating chart menu.
Polish reports in Access so they look terrific. Take yourself to another level. Equations, Back Color, Alternate Back Color. Write easy VBA Code. Tighten space to use less pages. Launch report from a menu, considering criteria only when it is filled…

636 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