Calculating Average Age in YY:MM

ScubaSteveFF

New Member
Joined
Apr 24, 2017
Messages
1
Can anyone advice me if it is possible to calculate an average after I have input some date to show individual ages as YY:MM?

I have a number of lists with ages input manually as YY:MM but I need to calculate an average of each of these.

Can this be done?
 

Excel Facts

Test for Multiple Conditions in IF?
Use AND(test, test, test, test) or OR(test, test, test, ...) as the logical_test argument of IF.
Unless I'm being really thick and that wouldn't be a major surprise! But....

yy:mm is a DATE format. So 12:4 means 2012 April. It does NOT mean 12 years and 4 months (OLD)

But I would say to do what you want and assuming what you mean by yy:mm is Years & Months Old then average would be:

Sum of (i= 1 to n) (12 x yy(i) + mm(i))/(n*12)

Ie convert the age to months and then average those and then convert back to Years and Months
 
Upvote 0
Hello,

You simply need to format cells to Month/Year, input data and use formula =average(a1:a10) *change the range with you range* and that's it.

If you already have data in as YY:MM there is a trick: use "text to columns" (on the data tab) -> delimited -> Other (and in the empty box set :).
Then, in a empty column near user formula: =concatenate(b1,"/",a1) *considering that now you have month in column B and year in column A*, copy the cells that have this formula and paste over them but "as values".
Format cells to MM/YY then do the "text to columns" button again but this time uncheck all boxes. This will update the formatting.

Then you can use the average formula.
 
Upvote 0
Presumably the ages (YY:MM) must be formatted as text. Here's a UDF :

Code:
Function AvAge(age As Range) As String
Dim cel As Range, arr As Variant, ttl#, c%
For Each cel In age
    If cel <> "" Then
        arr = Split(Replace(cel, ":", " "))
        ttl = ttl + arr(0) + arr(1) / 12
        c = c + 1
    End If
Next
AvAge = Int(ttl / c) & ":" & Round((ttl / c - Int(ttl / c)) * 12, 0)
End Function

Enter on the worksheet like : =AvAge(A1:A10)

The ages must all be entered as YY:MM or YY:M, otherwise the UDF will return an error.

If you prefer a non-vba solution that involves using a helper column, post again
 
Upvote 0

Forum statistics

Threads
1,215,516
Messages
6,125,285
Members
449,218
Latest member
Excel Master

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