title: Excel 2010 - Date Format ('%y%m') PLUS 1 month (Jan+1=Feb) and use an IF Query
body: <p><strong>Info:</strong>  Excel 2010 (no macros)<br>
  <strong>Data Origns:</strong> MySQL Query / phpMyAdmin <strong>Server:</strong>  Apache<br>
  <strong>Code is run via:</strong> Server SQL Query (copy &amp; paste in the phpMyAdmin) or in MySQL Workbench or using a custom shopping cart manager.<br>
  <strong>Exports to:</strong> Excel (.csv then to .xlsx for sales reports)<br>
  <strong>Notes:</strong> The workbook uses my Query as well as other data  </p>
  
  <p>My question is in 2 parts:<br>
  1)  The basic formula for adding X months to an existing Year/Month<br>
  2)  Extending that formula to be included in an "IF" Formula<br>
      If possible, not just the EXCEL but also the SQL formula  </p>
  
  <p>My columns are all formatted in my from my MySQL Query as below:<br>
  <code>DATE_FORMAT(T5.date_purchased + INTERVAL 1 MONTH, '%Y-%m-%b') As PayMonth,</code>  </p>
  
  <p>I am wanting to achieve the same in Excel with the results, but with data not pulled from the query, I insert them from other data sources.  </p>
  
  <p><strong>NOTE</strong> I don't want to have column 'D' showing, this should be in the formula.  The idea is that I can manually place the formula if I don't need the "IF" request below.<br>
  e.g.  B2+(formula D2) = E2  -->  2013-12-Dec Payable 2014-01-Jan</p>
  
  <pre><code>  |     A     |      B      |      C      |     D   |      E     |
  1 |salesdate  | salesmonth  | Distributor | +Months | Due
  2 |2013/12/28 | 2013-12-Dec | 1           | 1       | 2014-01-Jan
  3 |2013/11/16 | 2013-11-Nov | 2           | 2       | 2014-01-Jan
  4 |2013/10/15 | 2013-10-Oct | 3           | 3       | 2014-01-Jan
  </code></pre>
  
  <p>My request then extends to using it in an IF equation:<br>
  <code>DUE(Col E) = Date (ColB)+ (IF (Distributor=3 +(3 months) OR (Distributor=2 +(2 months) OR etc etc</code><br>
  I can have up to 5 distributors, so my OR may be long.
  Again, I don't want to even have a 'D' column, I can include it in a data sheet to be called from if needs be, but I don't want it in the sheet i'm working in.</p>
  
  <p>I've tried a number of ways of doing this but I'm unfamiliar with how the IF &amp; Date functions work in Excel.
  e.g.  <code>=DATE(YEAR(F7),MONTH(F7)+5+1,0)</code> 
  it works when the date is 28/12/2013 , not when I have it in 2013-12-Dec  </p>
  
  <p>Thank you in advance.  </p>
  
  <p><strong>UPDATE</strong> Using: <code>=DATE(YEAR(F2), MONTH(F2)+1+1,)</code> AND Format Cells (Custom) <code>yyyy-mm-mmm</code> I have the correct result if I am using Col A.<br>
  It does not work with Col B it results in a <code>#VALUE!</code> error.</p>