Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Yearly quarters formula

In my Google Spreadsheet I need to display the current quarter of the year for my analytics report.

like image 314
SirJord Avatar asked Jun 03 '15 12:06

SirJord


1 Answers

Tl;dr

Blank cells resolve to - instead of 4 :

=IF(ISBLANK(A10),"-",CONCAT("Q", ROUNDUP(MONTH(A10)/3,0)))

Note: for locale using ; as separator (E.g. France, Italy, more details):

=IF(ISBLANK(A10);"-";CONCAT("Q"; ROUNDUP(MONTH(A10)/3;0)))

Detailed answer

Building on Han Soalone's answer: if the cell is blank, it will return 4 as a blank (= empty) cell defaults to December 30, 1899 (source)

I suggest using ISBLANK to test first if the cell is empty, then CONCAT the letter Q to the quarter number to obtain:

  • Q1,
  • Q2,
  • Q3,
  • Q4,
  • - for empty cells

Formula based on date in cell A10:

=IF(ISBLANK(A10),"-",CONCAT("Q", ROUNDUP(MONTH(A10)/3,0)))
like image 116
Thomas B in BDX Avatar answered Sep 18 '22 01:09

Thomas B in BDX