Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 660
  • Last Modified:

Array formula

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
Pete Edwards
Asked:
Pete Edwards
  • 2
  • 2
  • 2
  • +3
5 Solutions
 
andrew_manCommented:
Some formulas are array formula.  You don't need to press the "ctrl,alt,enter"

Such as sumif, sumifs, sumproduct
0
 
Pete EdwardsAuthor Commented:
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
 
andrew_manCommented:
{=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
Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
Rob HensonIT & Database AssistantCommented:
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
 
Rory ArchibaldCommented:
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
 
Saqib Husain, SyedEngineerCommented:
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
 
Rob HensonIT & Database AssistantCommented:
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
 
NBVCCommented:
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
 
Pete EdwardsAuthor Commented:
Clears things up tremendously gang.

Thanks for the class.  :-)

Pete
0

Featured Post

Free learning courses: Active Directory Deep Dive

Get a firm grasp on your IT environment when you learn Active Directory best practices with Veeam! Watch all, or choose any amount, of this three-part webinar series to improve your skills. From the basics to virtualization and backup, we got you covered.

  • 2
  • 2
  • 2
  • +3
Tackle projects and never again get stuck behind a technical roadblock.
Join Now