I'm looking for a formula that will return the weighted average of revenue for all the products that contain a "PASSDAYONE"revenue sheet
For now, I am filtering on "PASSDAYONE" then using "sumproduct' This example returns a weighted average of 37,23. Is there a way to have this result returned in one go with a single formula?
Try the following formula:
=SUMPRODUCT((ISNUMBER(SEARCH("PASSDAYONE",A2:A9))*C2:C9*B2:B9))/SUMPRODUCT((ISNUMBER(SEARCH("PASSDAYONE",A2:A9))*B2:B9))
Above formula will first search for the string PASSDAYONE in the range A2:A9 and if found will include in SUMPRODUCT formula.
Related
If I have a range in excel, say A2:I2, that is used to store the results from a monthly competition, what formula do I use in excel to return the average of the three most right values?
The formula needs to account for not all columns being filled, i.e. one player might have 5 results, one might have 9, and one might have 1.
Thanks
You can combinedly use TEXTJOIN() and FILTERXML() like below.
=AVERAGE(FILTERXML("<t><s>"&TEXTJOIN("</s><s>",TRUE,B2:J2)&"</s></t>","//s[position()>" & COUNTA(B2:J2)-3 &"]"))
Here "<t><s>"&TEXTJOIN("</s><s>",TRUE,B2:J2)&"</s></t>" will construct a valid XML string.
XPATH parameter "//s[position()>" & COUNTA(B2:J2)-3 &"]" will return last 3 nodes to calculate Average by AVERAGE() function.
COUNTA(B2:J2)-3 will detect how many nodes have before last 3 nodes so that we can return rest of nodes means always last 3 nodes by FILTERXML() formula.
More about FILTERXML() here by JvdV Extract substring(s) from string using FILTERXML
Edit: For google sheet you can use below formula.
=AVERAGE(FILTER(B2:J2,(COLUMN(B2:J2)-Column(A2))>IF(COUNTA(B2:J2)<=3,0,COUNTA(B2:J2)-3)))
If one has Microsoft365, you could also use:
Formula in K2:
=AVERAGE(INDEX(SORTBY(FILTER(B2:J2,B2:J2<>""),SEQUENCE(1,COUNT(B2:J2)),-1),SEQUENCE(MIN(3,COUNT(B2:J2)))))
=IFERROR(AVERAGEIFS('Journal Input'!$AO$4:$AO$480,'Journal Input'!$O$4:$O$480,">="&F10,'Journal Input'!$O$4:$O$480,"<="&EOMONTH(F10,0)),"N/A")
This formula works but I need multiple average ranges added to this equation. My first average data range is AO but I have others in different columns (BB, BM, etc.) I would like to average along w/ AO. My multiple criteria's cover the beginning and end of the month F10. Perhaps an array is necessary? Any help is appreciated. Thanks Mike Link to picture example here
Here's a couple options. Enter this as an array formula (Ctrl+Shift+Enter):
=IFERROR(AVERAGE(IF(('Journal Input'!$O$4:$O$480>=F10)*('Journal Input'!$O$4:$O$480<=EOMONTH(F10,0)),CHOOSE({1,2,3},'Journal Input'!$AO$4:$AO$480,'Journal Input'!$BB$4:$BB$480,'Journal Input'!$BM$4:$BM$480))),"N/A")
Or, since it's the same conditions for all columns, you can average the AVERAGEIFS of each column (this doesn't need to be entered as an array formula):
=IFERROR(AVERAGE(AVERAGEIFS('Journal Input'!$AO$4:$AO$480,'Journal Input'!$O$4:$O$480,">="&F10,'Journal Input'!$O$4:$O$480,"<="&EOMONTH(F10,0)),AVERAGEIFS('Journal Input'!$BB$4:$BB$480,'Journal Input'!$O$4:$O$480,">="&F10,'Journal Input'!$O$4:$O$480,"<="&EOMONTH(F10,0)),AVERAGEIFS('Journal Input'!$BM$4:$BM$480,'Journal Input'!$O$4:$O$480,">="&F10,'Journal Input'!$O$4:$O$480,"<="&EOMONTH(F10,0))),"N/A")
I am trying to find a weighted avg score for each member. So column A for me is the member list for each loan. Column BC is where scores are. I will weight them by the principal balance and that is column K. I put the unique member numbers in column BF. I tried the formula below but it doesn't work, I appreciate any suggestions:
=IF($A$6:$A$46375=BF6,$BC$6:$BC$46375*$H$6:$K$46375)/SumIF($A$6:$A$46375=BF6,$BC$6:$BC$46375))
Two things:
Use Sumproduct on the numerator:
SUMPRODUCT(($A$6:$A$46375=BF6)*$BC$6:$BC$46375*$H$6:$K$46375)
The SUMIF has a typo, You do not use the = in that manner in a SUMIF:
SUMIF($A$6:$A$46375,BF6,$BC$6:$BC$46375)
So together:
=SUMPRODUCT(($A$6:$A$46375=BF6)*$BC$6:$BC$46375*$H$6:$K$46375)/SUMIF($A$6:$A$46375,BF6,$BC$6:$BC$46375)
It is not a CSE array formula. It does not require Ctrl-Shift-Enter.
array formula
write
=sum(if(A6:A46375=BF6,BC6:BC46375*K6:K46375,0)/sum(if(A6:A46375=BF6,BC6:BC46375,0))
then press ctrl+shift+enter
I have a cell that currently uses an array formula to return the name associated with the minimum hours worked for all my employees. However, what I am trying to do now is write an array formula that lists the three next employees with lowest hours. I have written a formula similar to this in the past, but can't seem to get the two formulas to appropriately match up.
My current return minimum employee formula in G5:
={INDEX(A:A,MATCH(MIN(IF(B:B=G3,IF(C:C>=$G$2,D:D)))&G3,D:D&B:B,0))}
Here is an example of my data:
...and now I'm attempting to incorporate in into the following array formula that would return a list of qualifying results as I dragged it down a column:
={(IF(ROWS(G$7:G7)<=F$8,INDEX($A$2:$A$8,SMALL(IF(Employees!$B$2:$B$8=$G$3,ROW($A$2:$A$8)-ROW($A$2)+1),ROWS(G$7:G7))),""))}
Currently, this array formula is only set up to match on position title and not the other qualifiers that I need from my minimum employee formula. How can I mesh the two formulas correctly? Thank you for any and all help and please, let me know if you need any clarification.
The ideal array result would show Boris and two blanks in consecutive rows in the Next 3 Employees chart.
Set your page up like this:
With the ranking in column F.
Then it is a quick modification of the last formula. Instead of MIN we use Small. The k part of the small equation is the ranking number:
=INDEX(A:A,MATCH(SMALL(IF(B:B=$G$3,IF(C:C>=$G$2,D:D)),F5)&$G$3,D:D&B:B,0))
This goes in G5. Is confirmed with ctrl-shift-enter. Then copied down for rows.
If do not want the errors to show then wrap it in IFERROR:
=IFERROR(INDEX(A:A,MATCH(SMALL(IF(B:B=$G$3,IF(C:C>=$G$2,D:D)),F5)&$G$3,D:D&B:B,0)),"NO MATCHES")
Could you help me solve the following?
I want to return the total sum, not the first match that it finds. My first preference is have indexing and matching with the sum total, if this CAN'T be done then an if statement. I have include 'sheet1!' in the formula as it will be over 2 work sheets. Below is an example of the formula, the data will be over 4000 lines.
I can't post a image as I'm new but the array formula is
=INDEX(Sheet1!$G$4:$I$10,MATCH(A2&B2,Sheet1!$G$4:$G$102&Sheet1!$H$4:$H$102,0),3)
In the data that it is matching it is return the first result of many, I what the total amount.
Try to use following formula:
=SUMIFS(Sheet1!$I$4:$I$102,Sheet1!$G$4:$G$102,A2,Sheet1!$H$4:$H$102,B2)
or
=SUMPRODUCT((Sheet1!$G$4:$G$102=A2)*(Sheet1!$H$4:$H$102=B2)*(Sheet1!$I$4:$I$102))