Let's establish first the following Month\Year-Quarter Relationship based on Fiscal Year End:
Assuming the Start and End dates are located at B2:C3
and the results by Fiscal Year End at C5:F25
enter the following formulas:
Fiscal Year End - March
in C7
:
=IF($C$3<$C$2,"!Err",
CONCATENATE("FY",
LOOKUP(MONTH($C$2),{1,4},{0,1})+TEXT($C$2,"yy"),
" Q",LOOKUP(MONTH($C$2),{1,4,7,10},{4,1,2,3})))
in C8:C25
:
=IF(OR(EXACT(C7,""),
EXACT(C7,
CONCATENATE("FY",
LOOKUP(MONTH($C$3),{1,4},{0,1})+TEXT($C$3,"yy"),
" Q",LOOKUP(MONTH($C$3),{1,4,7,10},{4,1,2,3})))),"",
CONCATENATE("FY",
MID(C7,3,2)+IF(RIGHT(C7,1)-4=0,1,0),
" Q",CHOOSE(RIGHT(C7,1),2,3,4,1)))
Fiscal Year End - June
in D7
:
=IF($C$3<$C$2,"!Err",
CONCATENATE("FY",
LOOKUP(MONTH($C$2),{1,7},{0,1})+TEXT($C$2,"yy"),
" Q",LOOKUP(MONTH($C$2),{1,4,7,10},{3,4,1,2})))
in D8:D25
:
=IF(OR(EXACT(D7,""),
EXACT(D7,
CONCATENATE("FY",
LOOKUP(MONTH($C$3),{1,4},{0,1})+TEXT($C$3,"yy"),
" Q",LOOKUP(MONTH($C$3),{1,4,7,10},{3,4,1,2})))),"",
CONCATENATE("FY",
MID(D7,3,2)+IF(RIGHT(D7,1)-4=0,1,0),
" Q",CHOOSE(RIGHT(D7,1),2,3,4,1)))
Fiscal Year End - September
in E7
:
=IF($C$3<$C$2,"!Err",
CONCATENATE("FY",
LOOKUP(MONTH($C$2),{1,10},{0,1})+TEXT($C$2,"yy"),
" Q",LOOKUP(MONTH($C$2),{1,4,7,10},{2,3,4,1})))
in E8:E25
:
=IF(OR(EXACT(E7,""),
EXACT(E7,
CONCATENATE("FY",
LOOKUP(MONTH($C$3),{1,10},{0,1})+TEXT($C$3,"yy"),
" Q",LOOKUP(MONTH($C$3),{1,4,7,10},{2,3,4,1})))),"",
CONCATENATE("FY",
MID(E7,3,2)+IF(RIGHT(E7,1)-4=0,1,0),
" Q",CHOOSE(RIGHT(E7,1),2,3,4,1)))
Fiscal Year End - December
in F7
:
=IF($C$3<$C$2,"!Err",
CONCATENATE("FY",
TEXT($C$2,"yy"),
" Q",LOOKUP(MONTH($C$2),{1,4,7,10},{1,2,3,4})))
in F8:F25
:
=IF(OR(EXACT(F7,""),
EXACT(F7,
CONCATENATE("FY",TEXT($C$3,"yy"),
" Q",LOOKUP(MONTH($C$3),{1,4,7,10},{1,2,3,4})))),"",
CONCATENATE("FY",
MID(F7,3,2)+IF(RIGHT(F7,1)-4=0,1,0),
" Q",CHOOSE(RIGHT(F7,1),2,3,4,1)))
TEXTJOIN()
is VBA a viable option? Lastly please share what you have done so far. Remember that SO is not a code writing service but rather a forum to get targeted help on errors in your code. – nbayly