+ Reply to Thread
Results 1 to 8 of 8

Formula to calculate average difference between dates.

  1. #1
    Registered User
    Join Date
    11-07-2019
    Location
    Lithuania
    MS-Off Ver
    Office 2013
    Posts
    52

    Formula to calculate average difference between dates.

    Hello,

    I've been trying to calculate average difference between two date columns without using any helper columns. Example workbook added.

    The whole row should be ignored if column B or C contains a blank cell

    Column A: Item name
    Column B: Date when the item was opened
    Column C: Date when the item was closed

    As far as i have achieved is this :
    Please Login or Register  to view this content.
    although it returns DIV/0 error.

    Thank you for any help and tips.
    Attached Files Attached Files
    Last edited by baxius; 10-18-2021 at 04:48 AM.

  2. #2
    Forum Expert
    Join Date
    10-10-2016
    Location
    Sheffield
    MS-Off Ver
    365 and rarely 2016
    Posts
    3,212

    Re: Formula to calculate average difference between dates.

    To start with your dates are text! if they were date (global replace of . with / in columns B and C and the formula works. If this is not possible a formula can be written but it is more complicated

    All your isnumber formulas are false (as they are text) hence the average is of no values and so divides by nothing (the error)
    Last edited by davsth; 10-18-2021 at 05:19 AM.

  3. #3
    Registered User
    Join Date
    11-07-2019
    Location
    Lithuania
    MS-Off Ver
    Office 2013
    Posts
    52

    Re: Formula to calculate average difference between dates.

    Thank you for your quick insight. These "Dates" are actually returned from an array with VBA. I'll have to look into their formatting settings then. Thank you again and +rep. Solved for now.
    Last edited by baxius; 10-18-2021 at 05:23 AM.

  4. #4
    Forum Expert
    Join Date
    10-10-2016
    Location
    Sheffield
    MS-Off Ver
    365 and rarely 2016
    Posts
    3,212

    Re: Formula to calculate average difference between dates.

    =AVERAGE(IFERROR(DATE(LEFT(C1:C13,4),MID(C1:C13,6,2),RIGHT(C1:C13,2))-DATE(LEFT(B1:B13,4),MID(B1:B13,6,2),RIGHT(B1:B13,2)),"")) as they stand, but far more painful

  5. #5
    Registered User
    Join Date
    11-07-2019
    Location
    Lithuania
    MS-Off Ver
    Office 2013
    Posts
    52

    Re: Formula to calculate average difference between dates.

    Yeah, not really the most optimal option. I'll try to figure out the formatting first. Cheers for your struggle.

  6. #6
    Forum Guru Bo_Ry's Avatar
    Join Date
    09-10-2018
    Location
    Thailand
    MS-Off Ver
    MS 365
    Posts
    7,211

    Re: Formula to calculate average difference between dates.

    Please try

    =AVERAGE(IFERROR(SUBSTITUTE(C1:C13,".","-")-SUBSTITUTE(B1:B13,".","-"),""))

    Ctrl+Shift+Enter
    Attached Files Attached Files

  7. #7
    Registered User
    Join Date
    11-07-2019
    Location
    Lithuania
    MS-Off Ver
    Office 2013
    Posts
    52

    Re: Formula to calculate average difference between dates.

    Wow, i actually didn't thought of that Bo_Ry. Thank you. Works like a charm.

  8. #8
    Forum Expert wk9128's Avatar
    Join Date
    08-15-2020
    Location
    Australia
    MS-Off Ver
    365 V2403 and WPS V2022
    Posts
    3,410

    Re: Formula to calculate average difference between dates.

    Try this array formula

    Formula: copy to clipboard
    Please Login or Register  to view this content.

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Replies: 5
    Last Post: 10-29-2014, 08:11 AM
  2. Calculate average difference of a series.
    By avinkris in forum Excel General
    Replies: 7
    Last Post: 09-25-2014, 10:44 AM
  3. [SOLVED] Formula to calculate sum/average based on number of unique dates in range
    By JennOlsen in forum Excel Formulas & Functions
    Replies: 5
    Last Post: 08-19-2014, 06:47 PM
  4. [SOLVED] Date format problem using a formula in VBA to calculate difference between times and dates
    By alicebrewer in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 10-05-2012, 03:13 AM
  5. formula needed to calculate the difference between 2 dates excluding wkend
    By danielle16dl in forum Excel - New Users/Basics
    Replies: 6
    Last Post: 04-08-2011, 10:39 PM
  6. Excel Formula trying to calculate difference between two dates
    By carolynb in forum Excel - New Users/Basics
    Replies: 1
    Last Post: 03-03-2010, 09:35 AM
  7. Replies: 2
    Last Post: 02-25-2006, 12:20 PM

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1