Note that there are some explanatory texts on larger screens.

plurals
  1. POCorrelation function for matching dates within a range of data
    primarykey
    data
    text
    <p>I have a spreadsheet with four columns where columns B and D contain counts of cars using various roads, taken in the last 30 days. A macro has processed the data in these ranges and changed the outlier values to "Bad" so the following correlation formula ignores them:</p> <pre><code>{=IFERROR(CORREL(IF(B4:B33&lt;&gt;"Bad";IF(D4:D33&lt;&gt;"Bad";B4:B33));IF(B4:B33&lt;&gt;"Bad";IF(D4:D33&lt;&gt;"Bad";D4:D33)));"0")} </code></pre> <p>Columns A and C contain the dates that the counts were taken on. Unfortunately, sometimes these dates aren't the same, no data available on Christmas in some areas, Boxing Day in others etc. Obviously this destroys the correlation, as it puts the dates out of synchronization and the correlation falls apart.</p> <p>Is there any way I can adapt the formula for it to check to see if the dates are the same before correlating? It'd almost be like a <code>vlookup</code>, find the date, if match, add to calculation, if not then go to the next date. I'm happy for it to only correlate 26 of the 30 days if there are that many conflicts. </p> <p>For example, for the last six days performed on the 28th of December, looking at six calendar days up to but not including the 28th: </p> <pre><code> A B C D 22/12/2012 9 22/12/2012 Bad 23/12/2012 10 23/12/2012 22 24/12/2012 3 24/12/2012 21 25/12/2012 7 26/12/2012 18 26/12/2012 8 27/12/2012 15 27/12/2012 15 </code></pre> <p>The last cells of columns C and D are blank.</p> <p>I would like the formula to only correlate the four days, 23rd, 24th, 26th and 27th, matching up the appropriate counts. </p> <p>Given that I'm going to be correlating this information with a number of locations, each with different reporting dates, filtering the dates before correlating and deleting unmatched dates is not a great option, but I will consider it if there is no other way.</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload