AverageIF Issue

canthony24

Board Regular
Joined
Mar 24, 2016
Messages
70
I have this averageif formula, =AVERAGE(AVERAGEIF(F4:F9,{"TRS","TRP","TRX"},G4:G9))

This works well when I have all of the criteria in the dataset, but if the dataset only has "TRS", the averageif returns and error because I think it's trying to locate all of the words inside the formula.

How do I not get the error if the dataset only has, let's say "TRS"?
 

Excel Facts

What did Pito Salas invent?
Pito Salas, working for Lotus, popularized what would become to be pivot tables. It was released as Lotus Improv in 1989.
Try putting an IFERROR in there, like this: =AVERAGE(IFERROR(AVERAGEIF(F4:F9,{"TRS","TRP","TRX"},G4:G9),FALSE))
Will have to use CONTROL+SHIFT+ENTER rather than just enter, as this is an array formula.
 
Upvote 0
=AVERAGE(AVERAGEIF(F4:F9,{"TRS","TRP","TRX"},G4:G9))

Is it possible that TRS can appear twice but TRX and TRP only once for example? In that case you wouldn't get a true average of all 4 of those rows because you would be averaging an average.

This array formula will fix your problem and also that issue

=AVERAGE(IF(F4:F9={"TRS","TRP","TRX"},G4:G9))

confirm with CTRL+SHIFT+ENTER

For a non array version try this

=SUM(SUMIF(F4:F9,{"TRS","TRP","TRX"},G4:G9))/SUM(COUNTIF(F4:F9,{"TRS","TRP","TRX"}))
 
Upvote 0

Forum statistics

Threads
1,224,823
Messages
6,181,181
Members
453,022
Latest member
Mohamed Magdi Tawfiq Emam

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