title: Good way to create quarter, half year and year summary formulas in Excel using VBA?
body: <p>I have a calendar bar in a document that has the same layout as the image. The calendar is copied from Power Pivot, but I want to calculate the quarter, half year and year cells using formulas. I want to create these formulas using VBA. Is there any clever way to do this?</p>
  
  <p>The calendar can start and end on any month and year. The quarters, half years and years are not always complete, meaning the full 3, 6 or 12 months are not always included in the calendar.</p>
  
  <p><a href="https://i.stack.imgur.com/L8ZLU.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/L8ZLU.png" alt="enter image description here"></a></p>
  
  <p>My best idea is to loop over all columns three times. The first time, building up a SUM formula month by month until landing on a year column and then writing the formula to that column. The next time, doing in the same for half-year columns. The third time, doing the same for quarter columns. But that seems too complicated to do something this simple.</p>