A family of Microsoft spreadsheet software with tools for analyzing, charting, and communicating data.
Hi,
Your function is returning a LONG variable and times are strored in Excel as decimals formatted to look like the times we recognise. Change the typr declaration of your function to DOUBLE and it will work for times and numbers.
If the sum of the times could exceed 24 hours then format the formula cell as
and if you are summing numbers format as GENERAL
Public Function DataSum(r As Range, Mode As String, col As Long) As Double
DataSum = Application.SumIf(r.Columns(1), Mode, r.Columns(col))
End Function