Array formula without some rows - excel

I have a question about an array formula. I want to a formula but not get the values for some rows.
I now have this array formula working: =IFERROR(INDIRECT(ADDRESS(SMALL(IF($H$7:$H$59>0,ROW($7:$59),""),ROW(A1)),1)),"")
I want to use this formula but only show the values from rows 7:36 and rows 40:59.
How can I adjust the formula to make it return only the values from these rows above? The rest of the formula is working fine.

First INDIRECT and ADDRESS are Volatile. Replace them with INDEX:
Your current formula non-volatile:
=IFERROR(INDEX(A:A,SMALL(IF($H$7:$H$59>0,ROW($7:$59),""),ROW(A1)),"")
Next we can add some more criteria to the IF to ignore those rows:
=IFERROR(INDEX(A:A,SMALL(IF(($H$7:$H$59>0)*((ROW($H$7:$H$59)<=36)+(ROW($H$7:$H$59)>=40)),ROW($7:$59),""),ROW(A1)),"")
Still an array formula that must be confirmed with Ctrl-Shift-Enter instead of Enter when exiting edit mode.

Related

Count number of rows with values excluding #N/A or Null formula values from the count [duplicate]

Currently using the following forumlas to count the number of records in all of column Z that does not have #N/A but it does not work. All the rows in Column Z have a formula itself (Which is why some of them display #N/A, its a VLOOKUP).
=COUNTA(Z:Z)-SUM(IF(ISNA(Z:Z),1))
=SUMPRODUCT(--(TRIM(Z:Z)<>"#N/A"))
These return a "0" value which is not true, what am I doing incorrect?
If you are using Excel 2010 or later, to count non-error values you can use (regular formula)
=AGGREGATE(3,6,Z:Z)
No reason to use an array formula for this, you can just do something like
=COUNTIFS(Z:Z, "<>#N/A",Z:Z, "<>")
or
=COUNTA(Z:Z) - COUNTIF(Z:Z,"=#N/A")
The first one counts every nonblank, non #N/A cell. The second does what you're trying to do now and subtracts the total of #N/A cells from the total of every nonblank cell. Maybe using ISNA is technically more correct or faster, but this probably works just as well for most cases.
This array formula sums the cells of range Z:Z that are not NA's :
=SUM(IF(NOT(ISNA(Z:Z)),Z:Z)) Ctrl+Shift+Enter
This one (which is probably what you want) sums all but errors:
=SUM(IF(NOT(ISERROR(Z:Z)),Z:Z)) Ctrl+Shift+Enter
And another (simpler) one
=SUM(IFERROR(H:H, 0)) Ctrl+Shift+Enter
Are you entering it as an array formula? Press Ctrl-Shift-Enter instead of just enter. I think the first formula should work.
=COUNTA(Z:Z)-SUM(IF(ISNA(Z:Z),1))

In Excel, how to find a average from selected cells

Need your help.
I have an excel sheet with two columns, like this:
I would to find an average of the number in the cells from column 2 that correspond to the numbers in column 1 which end either in 2 or 5. If column 2 has a blank cell or a letter, it should be ignored.
If one has the dynamic array formula FILTER():
=AVERAGE(FILTER(B2:B15,ISNUMBER(MATCH(--RIGHT(A2:A15),{2,5},0))))
If not then use this array formula:
=AVERAGE(IF(ISNUMBER(MATCH(--RIGHT(A2:A15),{2,5},0)),B2:B15))
Being an array formula it needs to be confirmed with Ctrl-Shift-Enter instead of Enter when exiting edit mode.

Calculate correlation in Excel after matching on a column

I need to calculate correlations for multiple years. The trick is in selecting appropriate rows from 2 columns after matching values a third column.
Use the CORREL() formula as an array formula:
=CORREL(IF($A$2:$A$12 = E2,$B$2:$B$12),IF($A$2:$A$12 = E2,$C$2:$C$12))
Being an array formula it needs to be confirmed with Ctrl-Shift-Enter instead of Enter when exiting edit mode.

Sumif array formula with nested if function only returning total on first value in array

I have a sumif formula wrapped in a sum formula so I can use an array where if the value in cell G2 equals "All" then I want to add up the values in range B2:B4 for three names in the data, but if the value cell G2 equals one of the three names, ie: Tim, then I just want to add up all the values in range B2:B4 for Tim. The formula works fine if only one name is used, but when I enter "All" into cell G2, only the value for the first name is added up. I'm using the below formula:
=SUM(SUMIF(A2:A4,IF(G2="All",{"Tim","Henry","Mike"},G2),B2:B4))
Thanks in advance for any ideas on how to get this to work.
Just in case these three values are the only occuring values in your list, you could just put this in an IF statement, like so:
=IF(G2="All",SUM(B2:B4),SUMIF(A2:A4,G2,B2:B4))
If you have other names in your lookup column, like so:
Your own formula work just fine using it as array formula. You just had to enter it through Ctrl+Shift+Enter
You could use a formula like:
=IF(G2="All",SUMPRODUCT(SUMIF(A2:A5,{"Tim","Henry","Mike"},B2:B5)),SUMIF(A2:A5,G2,B2:B5))
To prevent you have to enter it as array (it's still technically an array formula!)
No need to hard code the array or for an array formula:
=SUMIF(A:A,IF(G2="All","*",G2),B:B)

Dynamic Condense List to ignore blanks and spaces

Is there a formula that can be used to analyse an array (say A1:A10) and return a condense list of that same array but remove all blank cells? The only caveat is, every cell in range A1:A10 is a formula, with some resulting in "", which are visually blank but obviously the cell itself contains a formula.
In the screenshot, the data in A1 is a formula =IF(ISEVEN(ROW()),ROW(),"") so every other row will evaluate to an empty string.
The formula in C2 is the array formula
=IFERROR(INDEX(A:A,SMALL(IF($A$1:$A$10<>"",ROW($A$1:$A$10)),ROW(A1))),"")
Array formulas must be confirmed with Ctrl-Shift-Enter, unless you have an Excel version with the new Dynamic Arrays formulas.

Resources