cancel
Showing results forย 
Search instead forย 
Did you mean:ย 

Quarter formula

nvinay091
Deputy Chef I
Deputy Chef I

How to get which quarter from the date format 2022-01-31
Is there any formula to get, quarters ( Q1, Q2, Q3,Q4) from the date

2 REPLIES 2

tshoemaker
Deputy Chef III
Deputy Chef III

Just takes a little programming trick.. you can do the same in Excel as well.. you first extract the month from the date, then divide the month by 3 and round it up. To do this in Ruby, you use the Ceiling command.. here is an example that takes "now" (the current date and time) and converts it into the current quarter for "now":

=(now.month / 3.0).ceil

patil-ashish
Deputy Chef I
Deputy Chef I

(2022-01-31).strftime("%m") from this you will get which month it is and divide it by 3 to get which quarter.