I have the following index matchformula:
=IFERROR(INDEX($B:$B;(MATCH(1;($C:$C="Value1")*($D:$D=$F3)*($E:$E=OR("X";"Y";"Z"));0)));"")
however, I want $E:$E=OR("X";"Y";"Z") to be one of the conditions of the match: I want to see if E has one of these three values.
Currently it gives an error. How to achieve this condition in the match statement?
Thanks
I recommend restricting the ranges, using whole columns will make the formula slow......but try using ISNUMBER/MATCH for your OR, I.e.
=IFERROR(INDEX($B:$B;MATCH(1;($C:$C="Value1")*($D:$D=$F3)*ISNUMBER(MATCH($E:$E;{"X";"Y";"Z"};0));0));"")
Confirm with CTRL+SHIFT+ENTER
or you can try the following:
=IFERROR(INDEX($B:$B;(MATCH(1;($C:$C="Value1")*($D:$D=$F3)*(($E:$E="X")+($E:$E="Y")+($E:$E="Z"));0)));"")
this is an array formula, so press ctrl+shift+enter to calculate the formula.
Related
In Google Sheets, it's possible to create an array with formulas with in it. For example, ={SUM(1,2);SUM(3,4)} evaluates to a column with the numbers 3 and 7.
When I try the same thing in Excel, I get a formula syntax error. Is a similar thing possible? I've also tried putting names defined with LET in an array, but that throws the same error.
Thanks!
You can use CHOOSE function to combine formulas in array:
=CHOOSE({1;2},SUM(1,2),SUM(3,4))
formula works for O365, for earlier versions select desired count of cells and enter formula in first cell as array formula (with CSE).
Is there anyway to use AVERAGEIF or a similar function that treats text value as 0 and not just ignore them. Something similar to AVERAGEA function, but with multiple criteria?
I saw a similar question here which wanted to treat blanks or empty cells as 0. The answer suggested to use array formulas to add 0 to it. Not sure if it holds for other texts as well.
If you do NOT want to count blanks, you can use:
=SUM(A1:A10)/COUNTA(A1:A10)
(If you wanted to count blanks, something like sum(rng)/rows(rng) would do it)
You can use a similar technique to include criteria for AVERAGEIF
For example, given:
If you want to average all the values in Column A where a is in Column B:
=SUMIF(B1:B10,"a",A1:A10)/COUNTIF(B1:B10,"a")
It would be similar to the other link:
=AVERAGE(IFERROR(--A1:A10,0))
It is an array formula and with Excel to confirm an array formula one must use Ctrl-Shift-Enter instead of Enter when exiting edit mode.
One Note: This will treat blanks as 0 also, so make sure it only refers to the data set desired.
Similar to Rohan's post, I personally would break it down to see how many strings are pushing down your average. But if you want it all in one cell:
That is an asterisk inside the double quotes
one cell: =SUM(E1:E10)/(COUNTIF(E1:E10,"")+COUNTIF(E1:E10,"<>*"))
break down:
Non-Numeric: COUNTIF(E1:E10,"*****")
Numeric: COUNTIF(E1:E10,"<>*")
spreadsheet link
1
I want to combine a formula that disregards cells where there is a 0 in order to average and also to disregard cells where there is an error such as DIV/0.
I have these two formulas which achieve either of these functions but not both. How would I combine them?
{=AVERAGE(IF(ISNUMBER(M2:P2),M2:P2))}
=AVERAGEIF(M2:P2,"<>0")
You would simply add the criterion of the second to the first:
=AVERAGE(IF(ISNUMBER(M2:P2)*(M2:P2<>0) ,M2:P2))
This is still an array formula and as such needs to be confirmed with Ctrl-Shift-Enter instead of Enter. If done properly then Excel will put {} around the formula.
you could use an if() to check for either condition then use the appropriate average function.
#Scott : better than mine...
Tryingto CountIf with Exclusions and multiple criteria,
Here's an example of just multiple critera:
=SUM(COUNTIFS(A1:A9,"YES",B1:B9,{"JOHN","GEORGE","RINGO","PAUL"}))
Here's an example of just exlusion:
=SUM(COUNTIFS(A1:A9,"YES",B1:B9,"<>*JOHN*"))
And here's the sum we're currently got but not working:
=SUM(COUNTIFS(A1:A9,"YES",B1:B9,{"<>*JOHN*","<>*GEORGE*","<>*RINGO*","<>*PAUL*"}))
When criteria becomes too complex for COUNTIFS, you can often use an array formula. I think the following array formula will achieve your goal...
=SUM(IF(A1:A9="YES",1,0)*(IF(ISNUMBER(FIND("JOHN",B1:B9)),0,1))*(IF(ISNUMBER(FIND("GEORGE",B1:B9)),0,1))*(IF(ISNUMBER(FIND("RINGO",B1:B9)),0,1))*(IF(ISNUMBER(FIND("PAUL",B1:B9)),0,1)))
Make sure to use CTRL+SHIFT+ENTER to enter the array formula.
The blue cell summates to 1, but that is not correct and it should summate to more because of the row text match with B47 row. Any ideas what's wrong?
SUMIF is not supposed to work with more than one criteria (you can't check multiple criteria within one SUMIF as you tried in your formula).
This formula will calculate the right result for you: =SUM(B3:BI3*(IFERROR(MATCH(B2:BI3,B47:AL47,0)>0,0))), this is an array formula, so you need to press CTRL+SHIFT+ENTER after it.
MATCH(...): look for all students whether they are in the list with requirments (this is the part which works only as array formula)
IFERROR(...): converts #N/A errors to 0
If I am not wrong, you are trying to calculate the number of students for a particular project with skill1 and skill2.
You may also try using COUNTIFS() function. This works for multiple criteria.