AverageIF less than 15 including values under 0 (negative numbers)

floW_5

New Member
Joined
Jan 4, 2024
Messages
29
Office Version
  1. 365
Platform
  1. Windows
Sample.xlsx
ABCDEFG
1Sample1Product 1Product 2Product 3DiffAverage below 0
2$6.85$10.7657.08%-18.13%
3$11.75$7.55-35.74%Average above 0
4$3.58$3.22-9.93%34.87%
5$3.70$3.49-5.68%
6$8.28$5.19-37.28%Average if less than 15 including negative numbers
7$7.50$8.4512.67%-2.98%
8$2.50$2.19$2.45-2.00%Should be 12.99
Sheet1
Cell Formulas
RangeFormula
G2G2=AVERAGE(FILTER(E2:E8,(E2:E8<=0)*SUBTOTAL(2,OFFSET(E1,SEQUENCE(ROWS(E2:E8)),0))))
G4G4=AVERAGE(FILTER(E2:E8,(E2:E8>=0)*SUBTOTAL(2,OFFSET(E1,SEQUENCE(ROWS(E2:E8)),0))))
G7G7=AVERAGE(FILTER(E2:E8,(E2:E8<=15)*SUBTOTAL(2,OFFSET(E1,SEQUENCE(ROWS(E2:E8)),0))))
E2:E8E2=IFERROR(IF(D2,(D2-B2)/B2,(C2-B2)/B2),"")


So I am able to average column E either using the negative or positive values with the 2 separate formulas I have in cell G2 and G4. Formula working as intended
BUT
when I want to average up only cells in column E that is less than 15, the formula calculates up the total column instead.
For this particular criteria, i am trying to achieve averaging cells that is "less than 15" from column E, which includes BOTH negative and positive numbers. For my particular sample, this would EXCLUDE E2 (since 57.08 is greater than 15) but INCLUDES E7 (12.67 less than 15) AND the other cells with the negative value since they are also technically less than 15. The end result SHOULD be 12.99 but instead its showing 2.98 averaging up the whole column instead.

Can someone please advise me on what I am missing or doing wrong about the formula in G7 that is averaging up the whole column instead of what I am trying to achieve? Thank you in advance
 

Excel Facts

Which Excel functions can ignore hidden rows?
The SUBTOTAL and AGGREGATE functions ignore hidden rows. AGGREGATE can also exclude error cells and more.
Hi, numbers formatted as percentages are actually 1/100th of the value you see in the cell.

So either:
Rich (BB code):
=AVERAGE(FILTER(E2:E8,(E2:E8<=15%)*SUBTOTAL(2,OFFSET(E1,SEQUENCE(ROWS(E2:E8)),0))))

Or
Rich (BB code):
=AVERAGE(FILTER(E2:E8,(E2:E8<=0.15)*SUBTOTAL(2,OFFSET(E1,SEQUENCE(ROWS(E2:E8)),0))))
 
Upvote 0
Solution
You need to use 0.15 as you are dealing with percentages
 
Upvote 0
Hi, numbers formatted as percentages are actually 1/100th of the value you see in the cell.

So either:
Rich (BB code):
=AVERAGE(FILTER(E2:E8,(E2:E8<=15%)*SUBTOTAL(2,OFFSET(E1,SEQUENCE(ROWS(E2:E8)),0))))

Or
Rich (BB code):
=AVERAGE(FILTER(E2:E8,(E2:E8<=0.15)*SUBTOTAL(2,OFFSET(E1,SEQUENCE(ROWS(E2:E8)),0))))
Haha yes of course it does and I deal with % everyday day. that did not cross my mind at all when trying to figure this out. Feeling brain dead in this moment

Thank you kindly sir
 
Upvote 0
Glad we could help & thanks for the feedback.
 
Upvote 0

Forum statistics

Threads
1,223,952
Messages
6,175,595
Members
452,657
Latest member
giadungthienduyen

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top