Formula for average of all networkdays values between 2 columns

PatrickSchmidt

New Member
Joined
Apr 30, 2014
Messages
25
Hi,
I have this formula to find the difference between dates minus the weekends.
=IF(ISNUMBER(N2),MAX(0,NETWORKDAYS(M2,N2,)-1),"")
I have been putting it in an empty cell and filling down. Then in another cell I average that column.
My question is can I write one formula in one cell that will give me the same result?

Thank you
 

Excel Facts

Whats the difference between CONCAT and CONCATENATE?
The newer CONCAT function can reference a range of cells. =CONCATENATE(A1,A2,A3,A4,A5) becomes =CONCAT(A1:A5)
Hi,

Your formula is confusing me, why are you subtracting 1 from the result? Anyway, the way I think it should be done is with this ARRAY formula, see below for how to enter it. Extend the ranges as required but keep them all the same size'


=(AVERAGE(IF(N2:N12<>"",INT((WEEKDAY(M2:M12-{1,2,3,4,5},2)+N2:N12-M2:M12)/7)))*5)

or with your -1

=(AVERAGE(IF(N2:N12<>"",INT((WEEKDAY(M2:M12-{1,2,3,4,5},2)+N2:N12-M2:M12)/7)))*5)-1

This is an array formula which must be entered by pressing CTRL+Shift+Enter
and not just Enter. If you do it correctly then Excel will put curly brackets
around the formula {}. You can't type these yourself. If you edit the formula
you must enter it again with CTRL+Shift+Enter.
 
Upvote 0
Hi Mike thanks for the reply.
It's not working.
I pasted your formula into Z2 and it gives me 2 no matter what I change the dates in columns M and N to.
 
Upvote 0
Hi Mike thanks for the reply.
It's not working.
I pasted your formula into Z2 and it gives me 2 no matter what I change the dates in columns M and N to.

Did you read this bit of my post and ARRAY enter the formula?


This is an array formula which must be entered by pressing CTRL+Shift+Enter
and not just Enter. If you do it correctly then Excel will put curly brackets
around the formula {}. You can't type these yourself. If you edit the formula
you must enter it again with CTRL+Shift+Enter.
 
Upvote 0
Oh sorry I didn't understand that part.

It works, thanks a lot!

Is there a way to apply that to entire columns? I tried taking out the numbers in the range references but it errored. The file has rows added daily and I'd like not to have to change the numbers everytime.


The reason I put the minus one is because if the dates are May 5th and May 6th it gives it 2 days but I want just one for the situation.
 
Upvote 0
Hi,

ARRAY formula are slow and if you apply this to full columns you will see a noticeable deterioration in workbook speed. FWIW I wouldn't do this at all, I only wrote the formula as an exercise and because you wanted it. I would use a helper column and average the results of that. this does full columns, don't forget to ARRAY enter it:confused:


=(AVERAGE(IF(N:N<>"",(INT(WEEKDAY(M:M-{1,2,3,4,5},2)+N:N-M:M)/7)))*5)-1
 
Upvote 0

Forum statistics

Threads
1,215,374
Messages
6,124,571
Members
449,173
Latest member
Kon123

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