Averageifs using index match to dynamically select the entire column to average - excel-formula

how do i use average ifs using index match to return an average with a formula to select the column name? for example, how do i find the average of Column A, if 1or2 is 1? And if I want to average Column B it should calculate B automatically.

Like this:
=AVERAGEIFS(INDEX(A:F,0,MATCH("B",A1:F1,0)),A:A,1)

Related

Excel formula to calculate the sum of the first n% visible rows in a filtered column

As I stated in the title, I want to calculate the sum of the first n% rows in a filtered column. The total numbers of rows in the column varies due to the filtering options, so my formula must work with different values of n.
For example :
In column A, I have 10 rows that contain values from 10 to 1 ( I sorted them from largest to smallest ).
In column B, I have 10 corresponding rows that contain 2 names: 4 of them contain the value "Tom", six of them contain the value "Jerry". When I filter the whole table and select only the rows that contain the value "Jerry", I want to be able to calculate the sum of the first 20% of the corresponding 6 number values.
This could work without any filtering if you want.
With criteria for column B in E1 and percentage you looking for in F1 with the assumption we want to round up the percentage to integers.
So formula in D1:
=SUMPRODUCT(LARGE((B2:B11=E1)*(A2:A11),ROW(A1:INDEX($A:$A,ROUNDUP(COUNTIF(B2:B11,E1)*F1,0)))))
So, without your data, I came up with this, edit to suit your situation...
So, based on the comment, I did a second version:
The helper column in col C is used with sumproduct to give the result...
You can use the percentile function in AGGREGATE with SUMIFS to do what you want:
=SUMIFS(A:A,B:B,"Jerry",A:A,">="&AGGREGATE(16,7,A1:A10/(B1:B10="Jerry"),0.8))
If you want to use the filter to do the decision:
=SUMPRODUCT(SUBTOTAL(3,OFFSET(A1,ROW(A2:A10)-1,,1))*(A2:A10>=AGGREGATE(16,7,A2:A10,0.8)),A2:A10)

Sum column of values where separate column contains duplicate

I need to sum all values in Column A where Column B is a duplicate.
Above is a sample of the data. Column B has urls and Column A has counts for the urls. What I want is to sum the values in Column A for duplicate values in Column B.
Example:
The output for _.apelabs.net should be 6.
How can I achieve this?
I think you are looking for the function =COUNTIF(Range,Criteria)
Here is a link that shows a usage example.
As #Andresson stated, if you're trying to count the number of times a specific url appears, you might want to use the COUNTIF function: =COUNTIF(range, criteria).
COUNTIF Example:
Using =COUNTIF(B:B, "_.apelabs.net")
would return 3 in your sample data (assuming your image includes the only instances of "_.apelabs.net").
This example of the COUNTIF function is the same as saying, "count the total number of times a cell in Column B (i.e. B:B) equals "_.apelabs.net"."
However, if you're wanting to sum together all the values in Column A where the corresponding url in Column B matches the given criteria, you'll want the SUMIF function: =SUMIF(range, criteria, [sum_range]).
SUMIF Example:
Using =SUMIF(B:B, "_.apelabs.net", A:A)
would return 5 in your sample data (again assuming your image includes the only instances of "_.apelabs.net").
This example of the SUMIF function is the same as saying, "each time a cell in Column B (i.e. B:B) equals "_.apelabs.net", sum together the values in Column A (i.e. A:A) that are located in the same row as each "_.apelabs.net" found in Column B."
Additionally, you can also use a pivot table, as #ScottCraner suggested. It's all a matter in how you want to present your findings.

Average of two columns sum in excel

I have two columns, for example:
A(10,15,30) and B(2,3,No data)
And I need average: sum(a)/sum(B) but without sum any cell in A column if cell in the same row of B column is empty. I need a formula for this...
Based on this example, I'm looking for a formula which will give me average 5((10+15)/(2+3)), not 11((10+15+30)/(2+3)).
Use this:
=SUMIF(B:B,"<>",A:A)/SUM(B:B)

Excel: Find lowest value in range determined by a second column

I am trying to create a formula that will compare the value in one column and give the lowest value in another column.
For example if column A has a product code and column B has a price, how can I get column C to compare the values in column A to give the lowest stock price for each product code?
There's no MINIF (that's min if, not mini f) function (yet?), so back to the old days when one had to use array formulas before COUNTIF and SUMIF came about:
=MIN(IF($A$2:$A$8=A2,$B$2:$B$8)) in C2 and drag down. Be sure to enter as an array formula using Ctrl+Shift+Enter instead of just Enter

Count values in column E if the date in column F is greater than today

How do you count values in column E if the date in column F is greater than today.
This is what i have so far - but it returns 0.
=COUNTIF(E:E,F:F>=TODAY())
Please try:
=COUNTIFS(E:E,"<>",F:F,">="&TODAY())
Not sure why you are trying to use column E at all. The number of corresponding cells in E is the same as the number of column F cells matching criteria. It is irrelevant to finding the number of values in column F greater than today. First parameter is the range you want to count values in and the second is just the criteria. Try this:
=COUNTIF(F:F,">="&TODAY())
I prefer using sumproduct. THis can be used to count and find a weighted average. For counting, you wrap the range in --() and anything within that row is counted as 1. If you include a conditional statement, the row is only counted if the condition is true. You can add several conditions to filter out more data as needed. In the field below, I have the current date set to F12 or you can use the current date.
=SUMPRODUCT(--(E2:E10),--(F2:F10>F12))
There seems to be a bit of confusion about wether you want to count or sum the values in column E if the date is equal to or greater than todays.
Here's the sum formula
=SUM(IF(F2:F5>=TODAY(),E2:E5,0))
Hit ctrl+alt+delete so you get the curly brackets.
It should look like {=SUM(IF(F2:F5>=TODAY(),E2:E5,0))}
Use the same formula but with count if you want it to count.
=count(IF(F2:F5>=TODAY(),E2:E5,0))
Again, use ctrl+alt+delete

Resources