After 8 years working in a marketing company I came to the conclusion that writing monthly reports for management can get tedious - it's absolutely necessary to report KPI's to management but so much of the actual writing is just based on rules and can be susceptible to copy and paste errors. Thanks to the wonders of Google Sheets much of a summary statement for a report can be autogenerated via simple 'if' and formulas statements.

Formula to output the name and year of last month (i.e. the last full month before the month that you are in):

=text(EOMONTH(TODAY(),-2)+1,"MMMM yyy")

Formula to output the name and year of the month before last:

=text(EOMONTH(TODAY(),-3)+1,"MMMM yyy")

Formula for formatting a number into comma separated text:


Formula for stating if this month has seen an increase or decrease in traffic:


Formula for showing the month-on-month change as a percentage (and only show this as a positive to tie in with the increase/decrease statement before): =text(abs(((A2-A1)/A1)),"#%")

Extract the domain name from a full URL/page path:


function getDomainName (urlRange) {
  urlRange = strToArray(urlRange);
  var regex, returnValue = [];
  for (var i = 0; i < urlRange.length; i++) {
    url = urlRange[i];
    regex = new RegExp(/((www)\.)?.*(\w+)\.([\w\.]{2,6})/);
                     .replace(/^http(s)?:\/\//i, "")
                     .replace(/^www\./i, "")
                     .replace(/\/.*$/, "")]);
  return returnValue;

function strToArray(obj) {
  if (typeof obj == "string") {
    return [obj];
  } else {
    return obj;

Concatenate the contents from multiple cells into one cell with line breaks:

=ArrayFormula(CONCATENATE(A1:A4 & CHAR(10)))