Formulas needed average

ItalianPlatinum

Well-known Member
Joined
Mar 23, 2017
Messages
857
Office Version
  1. 365
  2. 2019
Platform
  1. Windows
Hello - I am looking to determine an average between dates based off of criteria. i thought i could do it simply but running into a roadblock. The elapsed time is just from the previous occurence with the last record from the last record to today. I dont want to add any other columns i would like to keep this simplistic so reaching out for help if there was a way i could still accomplish this. When i add a new record i move the today formula down and drag the other (prev - current) down 1. Thanks in advance.

Book4.xlsx
ABCDEF
1DateMeansElapsed timeAverage27.22222222
26-JanAAverage AFORMULA NEEDED
39-JanB3Average BFORMULA NEEDED
412-JanA3Average CFORMULA NEEDED
530-JanA18
65-FebB6
718-FebC13
815-MarA25
91-AprA17
109-AprC8
11152
Sheet1
Cell Formulas
RangeFormula
F1F1=AVERAGE(C:C)
C3:C10C3=A3-A2
C11C11=TODAY()-A10
 
No, Google Sheets does not support the AGGREGATE function, change to:

Code:
=AVERAGE(LARGE(IF($B$2:$B$10=D2,$A$2:$A$10,""),ROW(INDIRECT("1:"&COUNTIF($B$2:$B$10,D2)-1))) 
-LARGE(IF($B$2:$B$10=D2,$A$2:$A$10,""),ROW(INDIRECT("2:"&COUNTIF($B$2:$B$10,D2)))), 
TODAY()-LARGE(IF($B$2:$B$10=D2,$A$2:$A$10,""),1))
 
Upvote 0
Solution

Excel Facts

How to fill five years of quarters?
Type 1Q-2023 in a cell. Grab the fill handle and drag down or right. After 4Q-2023, Excel will jump to 1Q-2024. Dash can be any character.
Doesn't seem to be yielding results did it work for you?

Book4.xlsx
ABCDEFGHIJ
1DateMeansElapsed timeAverage27.33333333ABC
21/6/2023AA80.562750
31/9/2023B3B80.518
41/12/2023A3C#VALUE!44
51/30/2023A1817
62/5/2023B6elapsed161216153
72/18/2023C13Average49122102
83/15/2023A25
94/1/2023A17
104/9/2023C8
11153
Sheet2
Cell Formulas
RangeFormula
I2I2=A6-A3
J2J2=A10-A7
F1F1=AVERAGE(C:C)
F2:F4F2=AVERAGE(LARGE(IF($B:$B=E2,$A:$A,""),ROW(INDIRECT("1:"&COUNTIF($B:$B,E2)-1))) -LARGE(IF($B:$B=E2,$A:$A,""),ROW(INDIRECT("2:"&COUNTIF($B:$B,E2)))), TODAY()-LARGE(IF($B:$B=E2,$A:$A,""),1))
H2H2=A4-A2
H3H3=A5-A4
H4H4=A8-A5
H5H5=A9-A8
H6H6=TODAY()-A9
I6I6=TODAY()-A6
J6J6=TODAY()-A10
H7:J7H7=AVERAGE(H2:H6)
C3:C10C3=A3-A2
C11C11=TODAY()-A10
 
Upvote 0
No, Google Sheets does not support the AGGREGATE function, change to:

Code:
=AVERAGE(LARGE(IF($B$2:$B$10=D2,$A$2:$A$10,""),ROW(INDIRECT("1:"&COUNTIF($B$2:$B$10,D2)-1)))
-LARGE(IF($B$2:$B$10=D2,$A$2:$A$10,""),ROW(INDIRECT("2:"&COUNTIF($B$2:$B$10,D2)))),
TODAY()-LARGE(IF($B$2:$B$10=D2,$A$2:$A$10,""),1))
I noticed while expanding the formula to my larger dataset it doesn't seem to do an average based off of the elapsed time (row 11). for example i put 1,000 days in there and the averages based off of criteria (A,B,C) didn't change
 
Upvote 0
actually i think this part of the formula would cover it so i should be ok the test i was doing i just added +1000 in there and the formula was correct

TODAY()-LARGE(IF($B$2:$B$10=D2,$A$2:$A$10,""),1))
 
Upvote 0

Forum statistics

Threads
1,223,911
Messages
6,175,322
Members
452,635
Latest member
laura12345

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