+ Reply to Thread
Results 1 to 6 of 6

correlation of 2 datasets with missing dates

  1. #1
    Forum Contributor
    Join Date
    12-03-2008
    Location
    Key West, FL
    MS-Off Ver
    365 Apps for Enterprise
    Posts
    665

    correlation of 2 datasets with missing dates

    I've attached a workbook which shows two sets of data. One is the historical prices of the S&P 500 and the other is the same, for Bitcoin. Since Bitcoin's prices change daily, but the stock market is only open on business days, I can't run a direct, day:day correlation.

    How could I "match" the dates, where we ignore the weekend/holiday bitcoin prices? (then, once matched, check the correlation between the two). I assume Vlookup is involved.

    Thanks
    Attached Files Attached Files

  2. #2
    Forum Expert
    Join Date
    08-12-2012
    Location
    Sydney, Australia
    MS-Off Ver
    Excel 2010
    Posts
    5,636

    Re: correlation of 2 datasets with missing dates

    i pulled list of US holidays off some website - only 2018

    anyways its every state so you need to purge as required and do the same for 2015 to 2017
    then i used this for the formula
    which is
    Formula: copy to clipboard
    Please Login or Register  to view this content.


    first determine if weekend
    if weekend gives "Weekend
    else...checks if holiday
    if holiday returns "holiday"
    else looks up the S&P equivalent for that day...

    now the correlation formula in formula H isn't what you probably want but its just to finish the example off
    Attached Files Attached Files
    If you are satisfied with the solution(s) provided, please mark your thread as Solved.
    Select Thread Tools-> Mark thread as Solved. To undo, select Thread Tools-> Mark thread as Unsolved.

  3. #3
    Forum Moderator
    Join Date
    01-21-2014
    Location
    St. Joseph, Illinois U.S.A.
    MS-Off Ver
    Office 365 v 2403
    Posts
    13,406

    Re: correlation of 2 datasets with missing dates

    I calculate there are 15 dates missing from the Bitcoin history.
    Formula: copy to clipboard
    Please Login or Register  to view this content.
    How do you want to handle those?
    Last edited by FlameRetired; 05-14-2018 at 11:37 PM.
    Dave

  4. #4
    Forum Contributor
    Join Date
    12-03-2008
    Location
    Key West, FL
    MS-Off Ver
    365 Apps for Enterprise
    Posts
    665

    Re: correlation of 2 datasets with missing dates

    Thanks! Is there a way to use vlookup or match in a way that creates a new set of price histories, which only contains data if both
    column A and Column D have matching dates?

    This way, either column could have "missing" dates and we would wind up with two new datasets with identical histories.


    (I'm on a little notepad at the moment so I can't visualize the workbook. But I think the dates for S&P history are in Column A
    and the dates for Bitcoin are in Column D)

  5. #5
    Forum Expert
    Join Date
    07-20-2011
    Location
    Mysore, India.
    MS-Off Ver
    Excel 2019
    Posts
    8,577

    Re: correlation of 2 datasets with missing dates

    ARRAY formula in G3 for common date
    Please Login or Register  to view this content.
    IN H3 for S&P
    Please Login or Register  to view this content.
    In I3 for Bitcoin
    Please Login or Register  to view this content.
    Drag down all formulas.
    Attached Files Attached Files
    Pl note
    Array formula should be confirmed with Ctrl+Shift+Enter keys together.
    If answere is satisfactory press * to add reputation.

  6. #6
    Forum Contributor
    Join Date
    12-03-2008
    Location
    Key West, FL
    MS-Off Ver
    365 Apps for Enterprise
    Posts
    665

    Re: correlation of 2 datasets with missing dates

    Thank all of you for helping out an old man! I'll close out this thread now.

+ 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. Correlation analysis with missing values
    By hsapir in forum Excel General
    Replies: 7
    Last Post: 08-07-2023, 10:41 PM
  2. [SOLVED] Correlation input range missing
    By huangwh88 in forum Excel Programming / VBA / Macros
    Replies: 10
    Last Post: 01-08-2018, 08:32 PM
  3. Replies: 3
    Last Post: 06-30-2017, 01:05 PM
  4. Replies: 8
    Last Post: 11-09-2013, 04:50 PM
  5. Excel Macro to find missing dates and insert missing date as blank row
    By JevaMarie in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 06-26-2013, 11:08 AM
  6. Correlation input range missing
    By leeto in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 02-20-2012, 10:18 AM
  7. Replies: 3
    Last Post: 07-01-2009, 11:47 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