Average function with multiple criteria

bgamach1

New Member
Joined
Apr 8, 2016
Messages
8
=IF(R8=5,AVERAGE(O3:O7)*0.96)

=IF(R8=7,AVERAGE(O3:O9)*0.96)

How do I combine these into one formula? I get #VALUE when I put =IF(R8=6,AVERAGE(O3:O8)*0.96),IF(R8=7,AVERAGE(O3:O9)*0.96)
 

Excel Facts

Can you sort left to right?
To sort left-to-right, use the Sort dialog box. Click Options. Choose "Sort left to right"
You have a parenthesis in the wrong place, and are closing out the expression before the second IF.
Try:
Code:
=IF(R8=6,AVERAGE(O3:O8)*0.96,IF(R8=7,AVERAGE(O3:O9)*0.96))
Note, if neither condition is met, it will return FALSE unless you add the last optional false argument, i.e.
Code:
=IF(R8=6,AVERAGE(O3:O8)*0.96,IF(R8=7,AVERAGE(O3:O9)*0.96,"neither condition met"))
 
Last edited:
Upvote 0
Depends on a few other things. Maybe:

=AVERAGE(OFFSET(O3,0,0,R8))*0.96

but this doesn't handle cases where R8 might not be a value you want.
 
Last edited:
Upvote 0
=IF(R8=5,AVERAGE(O3:O7)*0.96)

=IF(R8=7,AVERAGE(O3:O9)*0.96)

How do I combine these into one formula? I get #VALUE when I put =IF(R8=6,AVERAGE(O3:O8)*0.96),IF(R8=7,AVERAGE(O3:O9)*0.96)

Maybe this:

=AVERAGE(O3:INDEX($O:$O,IF(R8=5,7,IF(R8=7,9))))*0.96

Markmzz
 
Upvote 0

Forum statistics

Threads
1,215,330
Messages
6,124,307
Members
449,151
Latest member
JOOJ

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