(Nested) IF statement to calculate MEAN in Excel - arrays

I have collected values for several test persons and for different tasks, and I want to calculate the AVERAGE and STDEV for each of the test persons for each task. This is what my table looks like:
I want to calculate the AVERAGE and STDEV for each person and each task, and I want to do this with one formula and (as it is possible) no "help columns" or by filtering manually. On a different sheet (called "analysis") I have another table to show me the summarized data. It looks like this:
In the highlighted cell, I want to add the summarized AVERAGE (and there's a similar table for STDEV). So far, I tried:
=AVERAGE(IF(analysis!B1=values!$A$2:$A$13,IF(analysis!A2=values!$B$2:$B$13,values!$C$2:$C$13)))
... and many other variants of this, like switching the positions and so on. I also tried COUNTIF in the IF loop (that's a solution I found for somehow similar problems, but then I didn't find a way to tell Excel to just calculate the values where the test person and task was actually correct.
I guess it's because the IF statement doesn't work with an array, but this is just a guess. I searched for similar questions in different portals, but the main problem was that I really need Excel to return the correct values in order to calculate the mean - just returning TRUE or FALSE won't work (or at least I don't know how). I would appreciate every advice or solution you have!

Excel does not have a function called "mean". It uses the "Average" function.
Also, your formulas are array formulas and need to be confirmed with Ctrl-Shift-Enter (see screenshot for result).
=AVERAGE(IF(Analysis!B$1=Values!$A$2:$A$13,IF(Analysis!$A2=Values!$B$2:$B$13,Values!$C$2:$C$13)))
The same approach will apply to a StDev function.

Your formula is fine except that you need to change MEAN to AVERAGE. Also if you want to be able to pull the formula down and across to select the four combinations of Task and Test Person, you need to fix the row and column with $ signs
=AVERAGE(IF(analysis!B$1=values!$A$2:$A$13,IF(analysis!$A2=values!$B$2:$B$13,values!$C$2:$C$13)))
Make sure that you enter it as an array formula using CtrlShiftEnter
You can then get the standard deviation in exactly the same way replacing AVERAGE by STDEV or STDEV.S (for sample SD, the usual one) or STDEV.P (for population SD).

Related

How do I count the number of filled-in rows of a sheet based on the contents of a column?

Disclaimer: I am completely self-taught in google sheets
I have a sheet with columns for Date, Place, Title, etc. I am attempting to count how many rows have all their cells filled out, but only want to add up the rows within a certain time period (i.e. based on the "date" cells, which are column A.)
=SUM(ARRAYFORMULA(AND(
ISBETWEEN(A9:A,DATE(2022,1,21),DATE(2022,4,1)),
ISTEXT(B9:B)=ISTEXT(C9:C)=ISTEXT(D9:D)=TRUE)))
Currently I have this formula, which relies on an "AND" function to check that both the "ISBETWEEN" and "ISTEXT" criteria are met. However, I think this is keeping "ARRAYFORMULA" from working (I originally used "SUMPRODUCT", but that didn't work either.) If that isn't the problem, the fact that the different references aren't somehow logically connected makes wonder if this would method would even work to begin with...
So, what functions could I use to accomplish my goal?
I would prefer to contain all of this in one formula, but at this point I'd be fine utilizing a separate hidden sheet if what I'm doing isn't possible in just one cell.
(I've done my best to try and find if this has already been asked, but honestly I'm not sure how to properly phrase this, so sorry if this is a duplicate.)
try:
=COUNTA(IFNA(FILTER(B9:B; B9:B<>""; C9:C<>""; D9:D<>"",
A9:A>="2022-1-21*1"; A9:A<="2022-4-1"*1))
or use:
=SUMPRODUCT(B9:B100<>""; C9:C100<>""; D9:D100<>"";
A9:A100>="2022-1-21"*1; A9:A100<="2022-4-1"*1)

How to use index match (array formula) to return corresponding values from a drop down list?

Excel Screenshot
Excel Screenshot with Formulas
I have attached photos to show an idea of what I am trying to do. Basically, I have a very large list of features that are shared between certain groups. I want to use a drop down list of the features, and then have a formula that will output the group that has the lowest cost of that feature along with the cost of that feature within the group.
(Also you will see that I purposefully ignore zero values. I do this because not every group has a certain feature and those cells default to zero).
I figured out how to get the cost of the feature to output, but I'm having trouble getting to output the group name. I am assuming there will be an array formula to do this, but I am just starting to learn those and I'm having trouble with this one.
Well you could always use the same approach you used to pull in the value, by pulling in the index of the column heading that matches the computed min, and using an offset function to match on the right row:
=+INDEX($B$1:$D$1,MATCH($B$10,OFFSET($B$1:$D$1,MATCH($A$7,$A$2:$A$4,0),0),0))
The thing is, I'm not sure how you would want to handle ties, if 2 vendors had the same price, this would match the first one in the list.

SUM with IF conditions for cells containing both strings and numbers

I've got a bigger table with one column that I want to focus on, containing designation and a number. I want to simply sum the numbers that meet the criteria based on a designation.
For the simplification, I made an exercising sheet (on the pic) where I split second column into two - one string and one numeric. Since my file is quite large with many columns that would need this it would be inconvenient.
In the left column it's easy to solve the problem, it could be even easier with simple SUMIF function, but an array SUM(IF... function is, at least I think, only viable option here.
So I solved the first table with array function, but what confuses me is how to modulate the TRUE statement. Simple replacement of C:C
with
VALUE(MID(F:F;4;4))
which would format my cells to get the numbers from string does not work that way - returns zero in E12 field. F12 is just application of string to number for last cell, F10.
THIS formula does not work, even adapting to different versions of the tool.
I could use VB but if possible anyhow I would like to avoid it since parts will be shared on mobile phones.
Any ideas? Thanks a lot!
Left table was split, right original format
The array formula which you used can be replaced by the SumIf formula like below...
=SUMIF(B:B,"B",C:C)
Also without the helper column, you can use the Sumproduct formula to achieve the desired output.
But don't refer the whole column in the formula like in the above SumIf formula.
Try this..
=SUMPRODUCT((B1:B10="B")*MID(F1:F10,FIND(",",F1:F10)+1,255)*1)
Change the ranges as per your requirement but remember to make them equal in size.

Use set of keywords to extract values from second worksheet

I'll try to explain the problem I'm facing best as I can.
A have a set of data that contains multiple duplicates extracted as an excel file. Within this data are "keys" that I want to use to filter out relevant data from another workbook.
I start by removing duplicates from the list of keywords and I think I got this working kind of satisfactory. I then try to extract and calculate the minimum from the values using the following array formula:
=MIN(VLOOKUP(Blad1!D2:D8,Blad2!A3:D9,2))
However, this doesn't work as expected. The value returns the minimum value from the target range, but seems to ignore the provided keywords. Instead it simply finds the minimum value of the entire range.
I am far from a professional when it comes to excel so any suggestions on how this could be done in a more efficient way are welcome.
Here is a link to a sample document.
These array formulas should be what you need.
'MINIF in F2,
=MIN(IF(COUNTIF($D$2:$D$8, Blad2!$A$2:$A$9&""), Blad2!$B$2:$B$9))
'MAXIF in G2
=MAX(IF(COUNTIF($D$2:$D$8, Blad2!$A$2:$A$9&""), Blad2!$C$2:$C$9))
'AVERAGEIF¹ in H2
=AVERAGE(IF(COUNTIF($D$2:$D$8, Blad2!$A$2:$A$9&""), Blad2!$D$2:$D$9))
Array formulas need to be finalized with Ctrl+Shift+Enter↵.
Try and reduce your full-column references to ranges more closely representing the extents of your actual data. Array formulas chew up calculation cycles logarithmically so it is good practise to narrow the referenced ranges to a minimum.
The results are 15, 35 and 23.6.
¹Note that this is NOT the native AVERAGEIF function or AVERAGEIFS function but an array formula. This approach was chosen due to the large number of criteria.

Array multiplication in Excel

In my excel document I have two sheets. The first is a data set and the second is a matrix of the relationship between two of the variables in my data set. Each possibility of the variable is a column in my matrix. I'm trying to get the sum of the products of the elements in two different arrays. Right now I'm using the formula {=SUM(N3:N20 * F3:F20)} and manually changing the columns each time. But my data set is over 800 items...
Ideally I'd like to know how to write a program that reads the value of the variable in my dataset looks up the correct columns in the matrix, multiplies them together, sums the products, and puts the result in the correct place in my data set. However, just knowing the result for all the possible combinations of columns would also save me alot of time. Its an 18x18 matrix. Thanks for any feedback!
Your question is a little bit ambiguous but as far as i understand your question you want to multiply different sets of two columns in the same sheet and put their result into the next sheet, is it so? if so, please post images of your work (all sheets). Your answer is possible even in Excel only without any vba code, thanks.
you can also use =SUMPRODUCT(N3:N20,F3:F20) for your formula instead of {=SUM(N3:N20 * F3:F20)}

Resources