Subtotal if average formula on visible cells

JBM91

New Member
Joined
Oct 22, 2019
Messages
25
Office Version
  1. 365
Platform
  1. Windows
Hi wizards!

I was hoping one of you bright heads could maybe help me out with a formula I'm struggling with :)

I am trying to get the average value of all visible (non-filtered) cells in range 'Data for 2023'!$Y$9:$Y$2000 where the corresponding value in column D is not equal to "DC jobs".
This is what I have landed on so far:

=SUMPRODUCT(('Data for 2023'!$D$9:$D$2000<>"DC jobs")*(SUBTOTAL(1;OFFSET('Data for 2023'!$Y$9;ROW('Data for 2023'!$Y$9:$Y$2000)-MIN(ROW('Data for 2023'!$Y$9:$Y$2000));0))))

But it gives me a div error and I can't figure out why because if I change to (SUBTOTAL(2 instead of (SUBTOTAL(1 it will correctly count numbers.

Any help would be greatly appreciated!

//Jay
 

Excel Facts

Copy PDF to Excel
Select data in PDF. Paste to Microsoft Word. Copy from Word and paste to Excel.
What version of Excel are you using?

I suggest that you update your Account details (or click your user name at the top right of the forum) so helpers always know what Excel version(s) & platform(s) you are using as the best solution often varies by version. (Don’t forget to scroll down & ‘Save’)

I would recommend using a helper column with something like
Excel Formula:
=subtotal(103,a2)
and then you can just use the averageifs function using the helper col as a criteria.
 
Upvote 0
What version of Excel are you using?

I suggest that you update your Account details (or click your user name at the top right of the forum) so helpers always know what Excel version(s) & platform(s) you are using as the best solution often varies by version. (Don’t forget to scroll down & ‘Save’)

I would recommend using a helper column with something like
Excel Formula:
=subtotal(103,a2)
and then you can just use the averageifs function using the helper col as a criteria.
Hi Fluff,

Thanks for the tip - I have updated my info!

How would you suggest using the helper column as a criteria if you don't mind me asking? (I am terribly sorry if the question is somewhat mundane, I think I might have the excel equivalent of domestic blindness from staring at it for so long).

=AVERAGEIF('Data for 2023'!$D$9:$D$2000;"<>DC jobs";'Data for 2023'!$Y$9:$Y$2000)
 
Upvote 0
If you have the helper column in col Z of the "Data for 2023" sheet you could use
Excel Formula:
=AVERAGEIFS('Data for 2023'!$Y$9:$Y$2000;'Data for 2023'!$D$9:$D$2000;"<>DC jobs";'Data for 2023'!$Z$9:$Z$2000,1)
 
Upvote 0

Forum statistics

Threads
1,223,889
Messages
6,175,223
Members
452,620
Latest member
dsubash

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