# Excel Formula to present Sequence by taking values from cells

#### LearnExcel&VBA

##### Member
I have tried at my end to make such a formula which fulfill the data Quarterly as Q12020, Q22020 after that then H22020, H12021, H22021 and so on. But i could not done this then posted here to get the help.

Actually the thing i have been trying to get by formula is that
If cell "H2" has Q12020 this quarter
then "M2" (has a formula) that should be started from Q12020 this
and "M3" would be Q22020

"M2" and "M3" will always have quarter (that could be Q12020, Q22020, Q32020, Q42020 according to years)

and "M4" would be H22020
then
"M5" would be H12021
then
"M6" = H22021
"M7" = H12022
"M8" = H22022

and so on.

First 6 months will be consider as H1
Last six months will be consider as H2

If i change the Q12020 to Q32020 in cell "H2" then "M2" = Q32020 and "M3" = Q42020
then
and "M4" would be H12021
then
"M5" would be H22021
and so on

I would be glad if someone can help me with this.

#### Attachments

• 10.5 KB Views: 5

#### Excel Wizard

##### Member
Please try at M2
=IF(OR(LEFT(M1,2)={"Q2","H1"}),"H2-"&RIGHT(M1,4),IF(OR(LEFT(M1,2)={"Q4","H2"}),"H1-"&RIGHT(M1,4)+1,"Q"&ROWS(M\$2:M2)-1+MID(\$H\$2,2,1)&RIGHT(\$H\$2,4)))

#### Attachments

• 12.3 KB Views: 10

#### Peter Bartholomew

##### Well-Known Member
Code:
``````= LET(
seq, SEQUENCE(36),
offset, startQtr>2,
half, 1 + MOD(seq-offset, 2),
incrYr, QUOTIENT(seq+offset-2, 2),
year, StartYr+incrYr,
IF(seq>2,
"H" & half & "-" & year,
"Q" & (2*offset+seq) & "-" & StartYr) )``````

#### Attachments

• 11.9 KB Views: 5

#### LearnExcel&VBA

##### Member
Excel Wizard
Thank you so much for the help can you please add Q22020 and Q42020 as well

Currently it is working for Q12020 and Q32020

I would really appreciate the help.

#### LearnExcel&VBA

##### Member
Hi Sir,

I also need some addition in formula if you can help me out further with this that,

If I select Q42020 then first cell should show
Q42020
Q12021
Q22021
Then
H22021
H12022
H22022
and so on

Same if i select
Q22020
Then formula first cell will be
Q22020
Q32020
Q42020
Then
H12021
H22021
and so on

Rest will be same as already available in formula.

If I select Q12020 or Q32020
Then first 2 cell will be quarter then half.

#### Excel Wizard

##### Member
Please try at M2
=IF(ROWS(M\$2:M3)=1,H\$2,IF(ROWS(M\$2:M3)>2,IF(OR(LEFT(M2,2)={"Q2","H1"}),"H2-"&RIGHT(M2,4),IF(OR(LEFT(M2,2)={"Q4","H2"}),"H1-"&RIGHT(M2,4)+1,"Q"&MOD(MID(M2,2,1),4)+1&RIGHT(M2,4)+INT(MID(M2,2,1)/4))),"Q"&MOD(MID(M2,2,1),4)+1&RIGHT(M2,4)+INT(MID(M2,2,1)/4)))

#### Attachments

• 12.9 KB Views: 2