The formula to calculate YEAR & MONTH

ngocanh87

Board Regular
Joined
Mar 16, 2016
Messages
85
Office Version
  1. 2019
  2. 2016
Platform
  1. Windows
Hello all, I have file excel Date A Column, i want B col as condition below. thank all
-2016 ,2018,2019 ,2020 include the whole year
-In 2021 compounded quarterly (1~3.4~6.7~9,10~12)
-The year 2022 by month

Book1.xlsx
A
1
2
3Ngày nhập kho
4Input date
5登録日
631/08/2021
731/08/2021
831/08/2021
931/08/2021
1031/08/2021
1131/08/2021
1206/11/2021
1306/11/2021
1406/11/2021
1506/11/2021
1606/11/2021
1706/11/2021
1806/11/2021
1906/11/2021
2009/11/2021
2109/11/2021
2209/11/2021
2309/11/2021
2406/09/2021
2506/09/2021
2606/09/2021
2706/09/2021
2806/09/2021
2906/09/2021
3006/09/2021
3106/09/2021
3206/09/2021
3306/09/2021
3406/09/2021
3506/09/2021
3606/09/2021
3706/09/2021
3806/09/2021
3906/09/2021
4006/09/2021
4106/09/2021
4206/09/2021
4306/09/2021
4406/09/2021
4531/08/2021
4631/08/2021
4731/08/2021
4808/11/2021
4908/11/2021
5008/11/2021
5108/11/2021
5208/11/2021
5308/11/2021
5408/11/2021
5508/11/2021
5622/07/2021
5722/07/2021
5822/07/2021
5922/07/2021
6022/07/2021
6122/07/2021
6222/07/2021
6322/07/2021
6422/07/2021
6522/07/2021
6622/07/2021
6722/07/2021
6823/07/2021
6923/07/2021
7023/07/2021
7123/07/2021
7223/07/2021
7323/07/2021
7423/07/2021
7523/07/2021
7623/07/2021
7723/07/2021
7823/07/2021
7923/07/2021
8023/07/2021
8123/07/2021
8223/07/2021
8323/07/2021
8408/07/2021
8508/07/2021
8608/07/2021
8708/07/2021
8808/07/2021
8908/07/2021
9008/07/2021
9108/07/2021
9208/07/2021
9308/07/2021
9408/07/2021
9508/07/2021
9608/07/2021
9708/07/2021
9808/07/2021
9908/07/2021
10008/07/2021
10108/07/2021
10208/07/2021
10309/07/2021
10409/07/2021
10509/07/2021
10609/07/2021
10709/07/2021
10809/07/2021
10909/07/2021
11009/07/2021
11109/07/2021
11209/07/2021
11309/07/2021
11409/07/2021
11509/07/2021
11609/07/2021
11709/07/2021
11816/07/2021
11907/05/2022
12007/05/2022
12107/05/2022
12207/05/2022
12307/05/2022
12407/05/2022
12507/05/2022
12607/05/2022
12707/05/2022
12807/05/2022
12907/05/2022
13007/05/2022
13107/05/2022
13207/05/2022
13307/05/2022
13407/05/2022
13507/05/2022
13606/05/2022
13706/05/2022
13806/05/2022
13906/05/2022
14006/05/2022
14106/05/2022
14206/05/2022
14306/05/2022
14406/05/2022
14506/05/2022
14607/05/2022
14707/05/2022
14807/05/2022
14907/05/2022
15007/05/2022
15107/05/2022
15207/05/2022
15307/05/2022
15407/05/2022
15507/05/2022
15607/05/2022
15707/05/2022
15807/05/2022
15907/05/2022
16002/08/2021
16102/08/2021
16202/08/2021
16302/08/2021
16402/08/2021
16502/08/2021
16602/08/2021
16702/08/2021
16802/08/2021
16902/08/2021
17002/08/2021
17102/08/2021
17202/08/2021
17302/08/2021
17402/08/2021
17502/08/2021
17602/08/2021
17702/08/2021
17802/08/2021
17902/08/2021
18002/08/2021
18102/08/2021
18202/08/2021
18302/08/2021
18402/08/2021
18502/08/2021
18602/08/2021
18702/08/2021
18802/08/2021
18902/08/2021
19002/08/2021
19102/08/2021
19202/08/2021
19302/08/2021
19402/08/2021
19502/08/2021
19603/08/2021
19703/08/2021
19803/08/2021
19903/08/2021
20003/08/2021
20103/08/2021
20203/08/2021
20303/08/2021
20403/08/2021
20503/08/2021
20603/08/2021
20703/08/2021
20803/08/2021
20903/08/2021
21011/10/2021
21111/10/2021
21213/10/2021
21313/10/2021
21413/10/2021
21513/10/2021
21613/10/2021
21713/10/2021
21813/10/2021
21904/05/2022
22004/05/2022
22104/05/2022
22204/05/2022
22304/05/2022
22404/05/2022
22504/05/2022
22604/05/2022
22705/05/2022
22805/05/2022
22905/05/2022
23005/05/2022
23105/05/2022
23205/05/2022
23305/05/2022
23405/05/2022
23505/05/2022
23605/05/2022
23705/05/2022
23805/05/2022
BẢN Excel khi đã thao tác
 
when i use XL2BB it auto remove '
Ok, you are right. What happens if you try these formulas?

22 07 06.xlsm
ABC
627/02/201620162016
731/08/20217~9/20217~9/2021
815/10/202110~12/202110~12/2021
907/05/202205/202205/2022
Time periods
Cell Formulas
RangeFormula
B6:B9B6=IF(YEAR(A6)<2021,YEAR(A6),IF(YEAR(A6)=2021,INT((MONTH(A6)-1)/3)*3+1&"~"&INT((MONTH(A6)-1)/3)*3+1+2&"/"&YEAR(A6),MID(A6,4,7)))
C6:C9C6=IF(RIGHT(A6,4)-2021<0,RIGHT(A6,4),IF(RIGHT(A6,4)-2021=0,INT((MID(A6,4,2)-1)/3)*3+1&"~"&INT((MID(A6,4,2)-1)/3)*3+1+2&RIGHT(A6,5),MID(A6,4,7)))
 
Upvote 0
Solution

Excel Facts

Select a hidden cell
Somehide hide payroll data in column G? Press F5. Type G1. Enter. Look in formula bar while you arrow down through G.
i think it correct. Thank you and everyone so much.

1657096135473.png
 
Upvote 0
Just for my own benefit, is your computer set up to have mm/dd/yyyy as the default date format ?
 
Upvote 0
That explains it. I think the assumption was that your default was dd/mm/yyyy but it not automatically handling the text version seemed inconsistent with that.
Thank you for providing feedback. Glad we could help.
 
Upvote 0
Thanks for the clarification. It is good to know what worked on your side. (y)
 
Upvote 0

Forum statistics

Threads
1,223,234
Messages
6,170,891
Members
452,366
Latest member
TePunaBloke

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top