title: How To automatically calculate Qtr Revenue given only two dates and Total Revenue
body: <p>I could use some help writing an excel formula.</p>
  
  <p>Case: Revenue is generated between 2 dates, <code>Date A</code> and <code>Date B</code>.<br>
  These dates could go into the next year and spread across quarters.</p>
  
  <p>How can I split Revenue into <code>Q1 Revenue</code>, <code>Q2 Revenue</code>, <code>Q3 Revenue</code>, <code>Q4 Revenue</code> just based on my 2 dates and Total Revenue. 
  My thought was first identify which Qtr your dates fall into and then have an if statement that logically figures out the % and multiplies by the revenue.</p>
  
  <p>Currently I'm using this formula to determine Qtr: <code>=ROUNDUP(MONTH(DateA)/3,0)</code>. </p>
  
  <p>Similarly for <code>DateB</code>.</p>
  
  <p>Then, <code>=if(DateAQtr=2, ((6/30/2013-DateA)/(DateB-DateA))*Revenue, 0)</code>
  There are clearly problems with this like, what happens if <code>DateB(end Date)</code> is in <code>Q1</code> of the following year.  </p>
  
  <p>Denominator will always be <code>Date B</code> - <code>Date A</code>, giving you <code>total days</code>.<br>
  Numerator of <code>Start Qtr</code> is <code>=(LastDayofQtr - Start)</code>.<br>
  Numerator of any quarters in the middle will be the <code>full qtr length</code>.<br>
  Numerator of <code>End Qtr</code> is <code>=(EndDate - LastDayofPreviousQtr)</code>.  </p>
  
  <p>This is the logic. I'm trying to write into Excel formula to automate the process.</p>