How to average same cell across worksheets given a condition

sgoldman

New Member
Joined
Aug 5, 2020
Messages
2
Office Version
  1. 365
Platform
  1. Windows
Hello -

I'm trying to create a master Workbook that can take the average of the values of an individual cell across multiple workbooks, but given a certain condition is met. For example, I want to average all of the values of C3 (which is a number) across all worksheets, but only when cell A4 says "Sales Department" in that same worksheet.


Is there a formula that can help me with this? Thank you! This is my first post here, so please let me know if there's anything else I need.
 

Excel Facts

Remove leading & trailing spaces
Save as CSV to remove all leading and trailing spaces. It is faster than using TRIM().
Welcome to MrExcel!

It can be done, but it's tricky:

Book3
ABCDEFGHI
1SheetsDepartmentC3 Average
2NumberSheet4Sales Department7.5
310Sheet5
4Sales DepartmentSheet6
Sheet4
Cell Formulas
RangeFormula
I2I2=SUMPRODUCT(SUMIF(INDIRECT("'"&F2:F4&"'!A4"),H2,INDIRECT("'"&F2:F4&"'!c3")))/SUMPRODUCT(COUNTIF(INDIRECT("'"&F2:F4&"'!A4"),H2))


You need a list of your sheets, and a complicated formula. If you're open to a UDF (User-Defined Function), which requires enabling macros, it would be much easier.
 
Upvote 0

Forum statistics

Threads
1,215,467
Messages
6,124,985
Members
449,201
Latest member
Lunzwe73

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