Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

Array formula

Posted on 2013-12-02
9
Medium Priority
?
651 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
  • 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 400 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
Get free NFR key for Veeam Availability Suite 9.5

Veeam is happy to provide a free NFR license (1 year, 2 sockets) to all certified IT Pros. The license allows for the non-production use of Veeam Availability Suite v9.5 in your home lab, without any feature limitations. It works for both VMware and Hyper-V environments

 
LVL 34

Assisted Solution

by:Rob Henson
Rob Henson earned 400 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 400 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 400 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 34

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

Veeam Task Manager for Hyper-V

Task Manager for Hyper-V provides critical information that allows you to monitor Hyper-V performance by displaying real-time views of CPU and memory at the individual VM-level, so you can quickly identify which VMs are using host resources.

Question has a verified solution.

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

Cancel future meetings from user mailboxes in Office 365 using Remove-CalendarEvents
Lost Word File? Eagerly, need it back? Read ahead; this File Recovery guide is for you.
This Micro Tutorial demonstrates using Microsoft Excel pivot tables, how to reverse engineer competitors' marketing strategies through backlinks.
Have you created a query with information for a calendar? ... and then, abra-cadabra, the calendar is done?! I am going to show you how to make that happen. Visualize your data!  ... really see it To use the code to create a calendar from a q…

963 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