Average a date difference based on criteria

GergelySzakacs

New Member
Joined
Jan 31, 2022
Messages
3
Office Version
  1. 365
Hi Team,

I am having difficulty with the below problem. I need to average the day differences between two dates, based on other criteria.

Here is the sample spreadsheet:

1643624764127.png


So, I would need the average date difference between B and A colums for every A, B, and C categories. So, one day number for A, B and C categories.

I spend so many times already on this, I hope you guys can help me :)

Thanks,
Gergely
 

Excel Facts

Ambidextrous Undo
Undo last command with Ctrl+Z or Alt+Backspace. If you use the Undo icon in the QAT, open the drop-down arrow to undo up to 100 steps.
have you tried the =AVERAGEIF() function?
 
Upvote 0
Yes, I tried, but I got confused after a while. I am confused because of the range. For one line I can understand average if but not for a range. Can you help me how to do that?
 
Upvote 0
it's much easier with a helper column D

Book1
ABCDE
131/01/202207/02/2022A78.5
231/01/202208/02/2022B89.5
331/01/202209/02/2022C99
431/01/202210/02/2022A10
531/01/202211/02/2022B11
Sheet1
Cell Formulas
RangeFormula
E1:E3E1=AVERAGEIF($C$1:$C$5,C1,$D$1:$D$5)
D1:D5D1=B1-A1
 
Upvote 0
I know, but I would avoid any extra column. The source is a spreadsheet that is edited by a lot of people, so I want to keep it as simple as it can be.
 
Upvote 0
ok, try this

Book1
ABCD
131/01/202207/02/2022A8.5
231/01/202208/02/2022B9.5
331/01/202209/02/2022C9
431/01/202210/02/2022A
531/01/202211/02/2022B
Sheet1
Cell Formulas
RangeFormula
D1:D3D1=SUMPRODUCT(--(($C$1:$C$5=C1)*($B$1:$B$5-$A$1:$A$5)))/COUNTIF($C$1:$C$5,C1)
 
Upvote 0

Forum statistics

Threads
1,214,651
Messages
6,120,744
Members
448,989
Latest member
mariah3

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