# Categorize Data into Fiscal Year Based on Transaction Date

#### HotDogHippo

##### New Member
Hello,

I have a list of financial data that spans 3 fiscal years.

Fiscal year 2018 - April 1, 2018 - March 31st, 2019
Fiscal Year 2019 - April 1, 2019 - March 31st, 2020
Fiscal Year 2020 - April 1, 2020 - March 31st, 2021

The transaction date (YYYYMMDD) is in Column Q and wondering if it's possible to have a formula in Column R to identify which fiscal year the transaction falls into based on the above categories.

I.E.

Q R
Date of Transaction Fiscal Year
20180403 20182

Any help would be much appreciated...
Thanks!

 20180403​

### Excel Facts

Excel Joke
Why can't spreadsheets drive cars? They crash too often!

##### Well-known Member
Hi HotDogHippo,

Does this work for you?

HotDogHippo.xlsx
QR
1DateFiscal Year
2201701012016
3201804032018
4201909092019
5202004012020
6202003312019
Sheet1
Cell Formulas
RangeFormula
R2:R6R2=IF(MID(Q2,5,2)+0<4,LEFT(Q2,4)-1,LEFT(Q2,4))+0

#### HotDogHippo

##### New Member
Hi HotDogHippo,

Does this work for you?

HotDogHippo.xlsx
QR
1DateFiscal Year
2201701012016
3201804032018
4201909092019
5202004012020
6202003312019
Sheet1
Cell Formulas
RangeFormula
R2:R6R2=IF(MID(Q2,5,2)+0<4,LEFT(Q2,4)-1,LEFT(Q2,4))+0

Amazing....That does work...are you able to walk me through the logic of why it works?? Many thanks

#### Peter_SSs

##### MrExcel MVP, Moderator
Amazing....That does work
In that case, this modified version of it should too I think.

21 05 20.xlsm
QR
1DateFiscal Year
2201701012016
3201804032018
4201909092019
5202004012020
6202003312019
Fiscal Year
Cell Formulas
RangeFormula
R2:R6R2=LEFT(Q2,4)-(MID(Q2,5,2)-4<0)

##### Well-known Member

Amazing....That does work...are you able to walk me through the logic of why it works?? Many thanks
You're welcome!
The +0 parts are to make sure the numbers are treated as numeric, not text.
MID(Q2,5,2) checks the date characters 5 and 6, the month. If the month is less than 4 (April) then the fiscal year is last year, so I take the first 4 characters (year) and subtract one.
If the month is 4 or higher then it's the same fiscal year as the date, so I take the first 4 characters and add zero to force numeric.

Replies
0
Views
203
Replies
1
Views
100
Replies
3
Views
100
Replies
3
Views
176
Replies
3
Views
373

1,148,140
Messages
5,745,035
Members
423,917
Latest member
Frank1931

### 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.

### Which adblocker are you using?

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

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