Hello,
I have some "problems" with averageifs formula.
Maybe someone can give me some hints/help.
I have uploaded an exemple sheet with some notes about my "problem"
Thanks,
Hello,
I have some "problems" with averageifs formula.
Maybe someone can give me some hints/help.
I have uploaded an exemple sheet with some notes about my "problem"
Thanks,
=SUM(INDEX(((($B$7:$B$25=$B$3)*($C$7:$C$25=$C$3)+($B$7:$B$25=$C$3)*($C$7:$C$25=$B$3))>0)*($F$7:$F$25),0))/SUM(INDEX(((($B$7:$B$25=$B$3)*($C$7:$C$25=$C$3)+($B$7:$B$25=$C$3)*($C$7:$C$25=$B$3))>0)*(1),0))
Try this formula
Samba
Say thanks to those who have helped you by clicking Add Reputation star.
Thank's Siva!
This solve only half of my problem.
How to calculate only the last 3 value that meet that criteria?
Thanks,
Luciano
See attached. The formula is fairly compact, but is an array formula so if you change it you will need to press Ctrl + Shift + Enter to compute.
You can change the number of largest by adding/subtracting items from the final array of numbers {1,2,3}.
For your first question which I didnt see at first you could also use
=AVERAGE(IF(($B$3&$C$3=$B$7:$B$25&$C$7:$C$25)+($C$3&$B$3=$B$7:$B$25&$C$7:$C$25),$F$7:$F$25))
Which is also an array formula so needs Ctrl + Shift + Enter
Last edited by Hawkeye16; 07-30-2014 at 06:36 AM.
Despite the high cost of living, it remains very popular.
Don't forget to mark threads SOLVED when you get an answer and rep all the geniouses that helped you today!
Thank's Hawkeye16 !
Siva's formula work how i want. But i need that it that calculate only for last 3 value (for exemple).
I think it must make this index only for the last 3 values ???
Like in this post:![]()
$B$7:$B$25=$B$3)*($C$7:$C$25=$C$3)
http://www.excelforum.com/excel-gene...-criteria.html
But with more criteria
Thanks,
Last edited by B7Des; 07-30-2014 at 06:42 AM.
To get an average for the criteria satisfied in either column you can use this "array formula"
=AVERAGE(IF((B7:B25=B3)*(C7:C25=C3)+(B7:B25=C3)*(C7:C25=B3),F7:F25))
confirmed with CTRL+SHIFT+ENTER
and for only the last 3 satisfying those criteria (assuming there will always be at least 3) you can use this array formula
=AVERAGE(IF(ROW(F7:F25)>=LARGE(IF((B7:B25=B3)*(C7:C25=C3)+(B7:B25=C3)*(C7:C25=B3),ROW(F7:F25)),3),IF((B7:B25=B3)*(C7:C25=C3)+(B7:B25=C3)*(C7:C25=B3),F7:F25)))
change the bolded 3 for last n
Audere est facere
(self-deleted)
Last edited by XOR LX; 07-30-2014 at 06:56 AM.
Mr Hawkeye16 your formula will not work if we remove any one of last 3 rows
=SUM(INDEX((ROW($F$7:$F$24)>=LARGE(INDEX(((($B$7:$B$24=$B$3)*($C$7:$C$24=$C$3)+($B$7:$B$24=$C$3)*($C$7:$C$24=$B$3))>0)*ROW($F$7:$F$24),0),3))*($F$7:$F$24),0))/MIN(SUM(INDEX((ROW($F$7:$F$24)>=LARGE(INDEX(((($B$7:$B$24=$B$3)*($C$7:$C$24=$C$3)+($B$7:$B$24=$C$3)*($C$7:$C$24=$B$3))>0)*ROW($F$7:$F$24),0),3))*1,0)),3)
This one also will work
Ah, the last 3. I for some reason thought you meant the largest 3, which is what my attachment answered.
DaddyLongLegs - your formula actually can shorten to this
=AVERAGE(IF(ROW(F7:F25)>=LARGE(IF((B7:B25=B3)*(C7:C25=C3)+(B7:B25=C3)*(C7:C25=B3),ROW(F7:F25)),3),F7:F25))
Last edited by Hawkeye16; 07-30-2014 at 06:52 AM.
=SUM(INDEX(((($B$7:$B$25=$B$3)*($C$7:$C$25=$C$3)+($B$7:$B$25=$C$3)*($C$7:$C$25=$B$3))>0)*(ROW($F$7:$F$25)>=LARGE(INDEX(((($B$7:$B$25=$B$3)*($C$7:$C$25=$C$3)+($B$7:$B$25=$C$3)*($C$7:$C$25=$B$3))>0)*ROW($F$7:$F$25),0),3))*(F7:F25),0))/MIN(SUM(INDEX(((($B$7:$B$25=$B$3)*($C$7:$C$25=$C$3)+($B$7:$B$25=$C$3)*($C$7:$C$25=$B$3))>0)*(ROW($F$7:$F$25)>=LARGE(INDEX(((($B$7:$B$25=$B$3)*($C$7:$C$25=$C$3)+($B$7:$B$25=$C$3)*($C$7:$C$25=$B$3))>0)*ROW($F$7:$F$25),0),3))*1,0)),3)
Try this formula
I see, doesn't work if the number is greater than the actual matches it finds. I stand corrected.
There are currently 1 users browsing this thread. (0 members and 1 guests)
Bookmarks