Formulas needed average

ItalianPlatinum

Well-known Member
Joined
Mar 23, 2017
Messages
793
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
 

Excel Facts

Excel Wisdom
Using a mouse in Excel is the work equivalent of wearing a lanyard when you first get to college
I am unsure about simplicity, but I think I found a way. There are likely other ways that are more elegant...LOL. It seems to work and there is no need for the "today" calculation at the bottom of the data.
Book1
ABCDE
1DateMeansAverage
21/6/2023AA49
31/9/2023BB121
41/12/2023AC101
51/30/2023A
62/5/2023B
72/18/2023C
83/15/2023A
94/1/2023A
104/9/2023C
Sheet2
Cell Formulas
RangeFormula
E2:E4E2=LET(filt,SORT(FILTER($A$2:$A$10,$B$2:$B$10=$D2)),filt_dates,VSTACK(filt,TODAY()),cnt,COUNT(filt_dates),seq_lg,SEQUENCE(cnt-1,,2),seq_sm,SEQUENCE(cnt-1,,1),AVERAGE(SMALL(filt_dates,seq_lg)-SMALL(filt_dates,seq_sm)))

Hope that helps,

Doug
 
Upvote 0
Seems to not be working for me :confused:

1694220645701.png
 
Upvote 0
Hi,

What is the expected result in F2:F4?
Something like that hope i didnt fat finger one of the figures

Book4.xlsx
ABCDEFGHIJ
1DateMeansElapsed timeAverage27.22222222ABC
26-JanAAFORMULA NEEDED62750
39-JanB3BFORMULA NEEDED18
412-JanA3CFORMULA NEEDED44
530-JanA1817
65-FebB6elapsed160215152
718-FebC13Average49121101
815-MarA25
91-AprA17
109-AprC8
11152
Sheet1
Cell Formulas
RangeFormula
F1F1=AVERAGE(C:C)
I2I2=A6-A3
J2J2=A10-A7
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
Try this:

Book1
BCDE
1MeansAverage
2AA49.20
3BB121.50
4AC101.50
5A
6B
7C
8A
9A
10C
Sheet1
Cell Formulas
RangeFormula
E2:E4E2=AVERAGE(AGGREGATE(14,6,$A$2:$A$10/($B$2:$B$10=D2),SEQUENCE(COUNTIF($B$2:$B$10,D2)-1))-AGGREGATE(14,6,$A$2:$A$10/($B$2:$B$10=D2),SEQUENCE(COUNTIF($B$2:$B$10,D2)-1)+1),TODAY()-AGGREGATE(14,6,$A$2:$A$10/($B$2:$B$10=D2),1))
Press CTRL+SHIFT+ENTER to enter array formulas.
 
Upvote 0
Or

Book1
BCDE
1MeansAverage
2AA49.20
3BB121.50
4AC101.50
5A
6B
7C
8A
9A
10C
Sheet1
Cell Formulas
RangeFormula
E2:E4E2=AVERAGE(AGGREGATE(14,6,$A$2:$A$10/($B$2:$B$10=D2),ROW(INDIRECT("1:"&COUNTIF($B$2:$B$10,D2)-1))) -AGGREGATE(14,6,$A$2:$A$10/($B$2:$B$10=D2),ROW(INDIRECT("2:"&COUNTIF($B$2:$B$10,D2)))), TODAY()-AGGREGATE(14,6,$A$2:$A$10/($B$2:$B$10=D2),1))
Press CTRL+SHIFT+ENTER to enter array formulas.
 
Upvote 0

Forum statistics

Threads
1,215,069
Messages
6,122,954
Members
449,095
Latest member
nmaske

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