Formula Taking A Date & Returning A Year

SteveP29

New Member
Joined
Jul 1, 2007
Messages
28
Office Version
  1. 365
Platform
  1. Windows
Hi,
I'm working with a table, column D is populated with a date (cell D2 is 15/04/2020)
Column E is entitled Year.
I want the data in column E to equal the financial year (ie dates between 01/04/2020 and 31/03/2021 should return the result 2020 and so on)
On a separate worksheet (named Validation) I have the parameters for the calculation
A1 has Date From
B1 has Date To
C1 has Year

A2- A11 has the first of April for each year from 2020 to 2029
B2- B11 has the 31st March for each year from 2021 to 2030
C2- C11 has 2020 to 2029

I have tried the following formula: =LOOKUP(2,1/($A$2:$A$11<=[@[Date of Application]])/$B$2:$B11>=[@[Date of Application]]),$C$2:$C$11)
NB: [@[Date of Application]] is what appears in the formula when I reference D2 (15/04/2020 above)

The formula should return 2020 for cell E2 but it returns 1905

I don't understand why it isn't working, is it because the date I'm trying to use to define the year is within a table?
Or is it because my parameters are on a different sheet? because when I enter the formula in the Validation worksheet where the date parameters are, it works perfectly

Apologies for not posting screenshots or the file, but as it is for work and contains GDPR sensitive and personal data

Thanks in advance for any help
 
In that case try
Excel Formula:
=LOOKUP(2,1/(Validation!$A$2:$A$11<=[@[Date of Application]])/Validation!$B$2:$B11>=[@[Date of Application]]),Validation!$C$2:$C$11)
 
Upvote 0

Excel Facts

Can Excel fill bagel flavors?
You can teach Excel a new custom list. Type the list in cells, File, Options, Advanced, Edit Custom Lists, Import, OK
In that case try
Excel Formula:
=LOOKUP(2,1/(Validation!$A$2:$A$11<=[@[Date of Application]])/Validation!$B$2:$B11>=[@[Date of Application]]),Validation!$C$2:$C$11)
That's just returning 2029
 
Upvote 0
In that case can you please post some sample data.
MrExcel has a tool called “XL2BB” that lets you post samples of your data that will allow us to copy/paste it to our Excel spreadsheets, so we can work with the same copy of data that you are. Instructions on using this tool can be found here: XL2BB Add-in

Note that there is also a "Test Here” forum on this board. This is a place where you can test using this tool (or any other posting techniques that you want to test) before trying to use those tools in your actual posts.

Also I suggest that you update your Account details (click your user name at the top right of the forum) so helpers always know what Excel version(s) & platform(s) you are using as the best solution often varies by version. (Don’t forget to scroll down & ‘Save’)
 
Upvote 0
Apologies for the delay in getting back to you.
Here's the extract of the data etc

Applications Log (Fiddle Copy 2).xlsx
ABCD
1Week Int/extDate of ApplicationYear
23Int15/04/20202029
33Ext16/04/20202029
43Ext16/04/20202029
53Int 15/04/20202029
64Int 20/04/20202029
74Int 20/04/20202029
84Int 20/04/20202029
94Int 20/04/20202029
104Int 20/04/20202029
113Int 17/04/20202029
124Int 22/04/20202029
134Int 22/04/20202029
144Int 20/04/20202029
154Int 22/04/20202029
Data
Cell Formulas
RangeFormula
D2:D15D2=LOOKUP(2,1/(Validations!$A$2:$A$11>=[@[Date of Application]])/(Validations!$B$2:$B$11<=[@[Date of Application]]),(Validations!$C$2:$C$11))


Applications Log (Fiddle Copy 2).xlsx
ABCD
1Date FromDate ToYear
201/04/202001/04/202101/04/2020
301/04/202101/04/202201/04/2021
401/04/202201/04/202301/04/2022
501/04/202301/04/202401/04/2023
601/04/202430/03/202501/04/2024
701/04/202501/04/202601/04/2025
801/04/202601/04/202701/04/2026
901/04/202701/04/202801/04/2027
1001/04/202801/04/202901/04/2028
1101/04/202901/04/193001/04/2029
12
13
14202514/07/2025
15202703/05/2027
16202630/11/2026
17202827/04/2028
18202331/03/2024
19202701/04/2027
20202319/08/2023
Validations
Cell Formulas
RangeFormula
B14:B20B14=LOOKUP(2,1/($A$2:$A$10<=D14)/($B$2:$B$10>=D14),$C$2:$C$10)
 
Upvote 0
You've got the > & < the wrong way round, it should be
Excel Formula:
=LOOKUP(2,1/(Validations!$A$2:$A$11<=[@[Date of Application]])/(Validations!$B$2:$B$11>=[@[Date of Application]]),(Validations!$C$2:$C$11))
 
Upvote 0
Solution
You've got the > & < the wrong way round, it should be
Excel Formula:
=LOOKUP(2,1/(Validations!$A$2:$A$11<=[@[Date of Application]])/(Validations!$B$2:$B$11>=[@[Date of Application]]),(Validations!$C$2:$C$11))
And as soon as I changed it, it works perfectly, Thank you!!
 
Upvote 0
You're welcome & thanks for the feedback.
 
Upvote 0

Forum statistics

Threads
1,214,830
Messages
6,121,831
Members
449,051
Latest member
excelquestion515

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