+ Reply to Thread
Results 1 to 6 of 6

Calculate average difference between dates when they first appear in dataset

  1. #1
    Registered User
    Join Date
    01-29-2014
    Location
    London
    MS-Off Ver
    Excel 2010
    Posts
    13

    Calculate average difference between dates when they first appear in dataset

    Hi All,

    I have a large dataset with dates of visits and dates of purchases for each customer. The data looks like this:


    HTML Code: 

    I would like to know the "average number of days between first visit and first purchase" for every year (I know data are between 2004-2014 only).

    So, in the case of customer no.10 she made a first visit on 17-06-2011 but she made her first purchase on 18-02-2012 -> 246 days later. I would like to know the average days of difference between first visit and first purchase by year. So, I want to be able to say "The time that passed between first visit and first purchase for all customers in 2012 was X amount of days; in 2013 it was Y days, etc.". Remember, each customer has multiple rows of visits and purchases...

    I am open to any suggestion! Thanks!!
    Last edited by Billaus; 10-29-2014 at 04:31 AM.

  2. #2
    Forum Moderator - RIP Richard Buttrey's Avatar
    Join Date
    01-14-2008
    Location
    Stockton Heath, Cheshire, UK
    MS-Off Ver
    Office 365, Excel for Windows 2010 & Excel for Mac
    Posts
    29,464

    Re: Calculate average difference between dates when they first appear in dataset

    Hi,

    Would you attach the workbook with a larger sample of data. No need to include all years back to 2004 but few dozen representative rows from 2014 would be useful. Experience tells me that the actual data used by someone is often slightly different to the very small subset that appears in the text of a post.
    Richard Buttrey

    RIP - d. 06/10/2022

    If any of the responses have helped then please consider rating them by clicking the small star icon below the post.

  3. #3
    Registered User
    Join Date
    01-29-2014
    Location
    London
    MS-Off Ver
    Excel 2010
    Posts
    13

    Re: Calculate average difference between dates when they first appear in dataset

    That's actually copy-pasted from the dataset. All data look exactly like that

  4. #4
    Forum Expert
    Join Date
    03-28-2014
    Location
    Hyderabad,India
    MS-Off Ver
    Excel 2013
    Posts
    1,887

    Re: Calculate average difference between dates when they first appear in dataset

    HI,

    Have look this example this will work fine with the following assumptions

    1) All for a said customer will surly have Visit Date & Purchase date
    2) Always purchase date is will be immediate next to visit date
    3) Visit date all ways then the purchase date
    4) In case of looking for another customer change 10 to 30 make sure you have sufficient data for him

    Punnam
    Attached Files Attached Files

  5. #5
    Forum Moderator - RIP Richard Buttrey's Avatar
    Join Date
    01-14-2008
    Location
    Stockton Heath, Cheshire, UK
    MS-Off Ver
    Office 365, Excel for Windows 2010 & Excel for Mac
    Posts
    29,464

    Re: Calculate average difference between dates when they first appear in dataset

    Quote Originally Posted by Billaus View Post
    That's actually copy-pasted from the dataset. All data look exactly like that
    Hi,

    Would you nevertheless upload the workbook as requested. Be sure to include several customers and all permutations of data layouts. Experience here through the years tells me that what starts out as a simple text representation of data is often little use when it comes to applying a solution based on that text to the actual workbook itself. You need to help us to help you.

  6. #6
    Registered User
    Join Date
    01-29-2014
    Location
    London
    MS-Off Ver
    Excel 2010
    Posts
    13

    Re: Calculate average difference between dates when they first appear in dataset

    Attached!

    Actually, an even better alternative (if easier) would be to generate a new variable (new column) that gives me the difference between first visit and first purchase for each customer. That means I'd have one row with that value and all other rows for that customer as NA.

    Whatever easier...

    Thanks!
    Attached Files Attached Files
    Last edited by Billaus; 10-29-2014 at 08:15 AM.

+ 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. [SOLVED] calculate average after splitting the difference between item
    By Faridwahidi in forum Excel Programming / VBA / Macros
    Replies: 11
    Last Post: 10-20-2014, 11:07 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. How to calculate average in a large dataset
    By dolle in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 05-27-2013, 01:08 PM
  4. [SOLVED] Calculate difference between 2 date and times with average
    By Aeryn635 in forum Excel General
    Replies: 1
    Last Post: 12-14-2005, 11:10 PM
  5. How to calculate average from large dataset in several sheets?
    By Orf in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 12-12-2005, 07:10 AM

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