Check for most latest FY and only do lookup to the latest year's rows - Ignore the other years.

hananak

Board Regular
Joined
Feb 10, 2022
Messages
69
Office Version
  1. 365
  2. 2016
Platform
  1. Windows
Hi All,

I am looking for a formula in excel that will search for the latest year in column "A". Once found then do a lookup to only those rows which have the latest year and ignore the other years rows.

Currently, in column "A", there are three years. 20-21, 21-22 and 22-23 and 22-23 being the latest year. The formula should identify the latest year 22-23 and then do the lookup in column F on the 22-23 rows only and ignore the other years.

If in future the data changes to 20-21, 21-22, 22-23 and 23-24, it should pick 23-24 and do the lookup on 23-24 rows only.

The formula should be written in column E and lookup value is from column E will get it's values from lookup table in another sheet called Table.

Your help would be really appreciated.
 

Excel Facts

How to calculate loan payments in Excel?
Use the PMT function: =PMT(5%/12,60,-25000) is for a $25,000 loan, 5% annual interest, 60 month loan.
I'm not sure there are mathmatical equations that can determine that 23-24 > 23-22 > 22-21 > 20-21. You may have to input that in the formula when the time comes.
Lookups generally only return one value not a group of values. Are you asking for a filter of only rows with that FY in column A?
Is there data in Col B, C, or D that you want to be returned?

Please install the xl2bb add in and post a mini workbook as a sample of what you want. A sample of the Table would also be useful.
 
Upvote 0
additionally, to dynamically get the last fy, the values should be numbers, MAX function will not work on text strings.
 
Upvote 0
additionally, to dynamically get the last fy, the values should be numbers, MAX function will not work on text strings.
Thank for your quick reply.

Please see the mini sheet.

22-23.xlsx
ABCDE
4YearNameName 2AccLookup
520-21Data1Data2Data3Ignore as in column A year is 20-21
620-21Data1Data2Data3Ignore as in column A year is 20-21
720-21Data1Data2Data3Ignore as in column A year is 20-21
820-21Data1Data2Data3Ignore as in column A year is 20-21
920-21Data1Data2Data3Ignore as in column A year is 20-21
1020-21Data1Data2Data3Ignore as in column A year is 20-21
1120-21Data1Data2Data3Ignore as in column A year is 20-21
1220-21Data1Data2Data3Ignore as in column A year is 20-21
1320-21Data1Data2Data3Ignore as in column A year is 20-21
1420-21Data1Data2Data3Ignore as in column A year is 20-21
1521-22Data1Data2Data3Ignore as in column A year is 21-22
1621-22Data1Data2Data3Ignore as in column A year is 21-22
1721-22Data1Data2Data3Ignore as in column A year is 21-22
1821-22Data1Data2Data3Ignore as in column A year is 21-22
1921-22Data1Data2Data3Ignore as in column A year is 21-22
2021-22Data1Data2Data3Ignore as in column A year is 21-22
2121-22Data1Data2Data3Ignore as in column A year is 21-22
2221-22Data1Data2Data3Ignore as in column A year is 21-22
2321-22Data1Data2Data3Ignore as in column A year is 21-22
2421-22Data1Data2Data3Ignore as in column A year is 21-22
2522-23Data1Data2data10Lookup value in another sheet based on matching value in column D of this sheet only if year is 22-23
2622-23Data1Data2data11Lookup value in another sheet based on matching value in column D of this sheet only if year is 22-23
2722-23Data1Data2data12Lookup value in another sheet based on matching value in column D of this sheet only if year is 22-23
2822-23Data1Data2data13Lookup value in another sheet based on matching value in column D of this sheet only if year is 22-23
2922-23Data1Data2data14Lookup value in another sheet based on matching value in column D of this sheet only if year is 22-23
3022-23Data1Data2data15Lookup value in another sheet based on matching value in column D of this sheet only if year is 22-23
3122-23Data1Data2data16Lookup value in another sheet based on matching value in column D of this sheet only if year is 22-23
3222-23Data1Data2data17Lookup value in another sheet based on matching value in column D of this sheet only if year is 22-23
3322-23Data1Data2data18Lookup value in another sheet based on matching value in column D of this sheet only if year is 22-23
3422-23Data1Data2data19Lookup value in another sheet based on matching value in column D of this sheet only if year is 22-23
3522-23Data1Data2data20Lookup value in another sheet based on matching value in column D of this sheet only if year is 22-23
3622-23Data1Data2data21Lookup value in another sheet based on matching value in column D of this sheet only if year is 22-23
3722-23Data1Data2data22Lookup value in another sheet based on matching value in column D of this sheet only if year is 22-23
3822-23Data1Data2data23Lookup value in another sheet based on matching value in column D of this sheet only if year is 22-24
3922-23Data1Data2data24Lookup value in another sheet based on matching value in column D of this sheet only if year is 22-25
4022-23Data1Data2data25Lookup value in another sheet based on matching value in column D of this sheet only if year is 22-26
4122-23Data1Data2data26Lookup value in another sheet based on matching value in column D of this sheet only if year is 22-27
4222-23Data1Data2data27Lookup value in another sheet based on matching value in column D of this sheet only if year is 22-28
4322-23Data1Data2data28Lookup value in another sheet based on matching value in column D of this sheet only if year is 22-29
4422-23Data1Data2data29Lookup value in another sheet based on matching value in column D of this sheet only if year is 22-30
4522-23Data1Data2data30Lookup value in another sheet based on matching value in column D of this sheet only if year is 22-31
4622-23Data1Data2data31Lookup value in another sheet based on matching value in column D of this sheet only if year is 22-32
4722-23Data1Data2data32Lookup value in another sheet based on matching value in column D of this sheet only if year is 22-33
4822-23Data1Data2data33Lookup value in another sheet based on matching value in column D of this sheet only if year is 22-34
4922-23Data1Data2data34Lookup value in another sheet based on matching value in column D of this sheet only if year is 22-35
5022-23Data1Data2data35Lookup value in another sheet based on matching value in column D of this sheet only if year is 22-36
5122-23Data1Data2data36Lookup value in another sheet based on matching value in column D of this sheet only if year is 22-37
5222-23Data1Data2data37Lookup value in another sheet based on matching value in column D of this sheet only if year is 22-38
5322-23Data1Data2data38Lookup value in another sheet based on matching value in column D of this sheet only if year is 22-39
5422-23Data1Data2data39Lookup value in another sheet based on matching value in column D of this sheet only if year is 22-40
Trend
 
Upvote 0
if you do not want existing data in Cells B5:B24 then you'll need some vba to code that.

if you want blanks in E5:E24:
Excel Formula:
=if(A5="22-23","Lookup Formula","")

put that in E5 and copy down.
 
Upvote 0
if you do not want existing data in Cells B5:B24 then you'll need some vba to code that.

if you want blanks in E5:E24:
Excel Formula:
=if(A5="22-23","Lookup Formula","")

put that in E5 and copy down.
The data in each column is important and I need all the columns data.

Basically, I need two things:

1) I don't want hard coded "22-23" because when the data gets updated in future there will be 23-24 and after 1 year 24-25 and so on.

2) I would like the lookup formula to be dynamic and applicable only to the latest year rows and ignore all the rows where the year is old.

If the data gets updated and now we have 23-24 as well then the formula should automatically find the row from where 23-24 year is starting and apply lookup formula to all the rows which have 23-24 in column A and ignore the rest of the rows where in column A there are other years and not 23-24.

Do you think it is possible?
 
Upvote 0
You can't have both values and formulas in the same cells. (Column E).
to do what you ask dynamically you would need a vba routine to somehow figure out the highest precedence of the date ranges (A lookup array that would entail many year ranges with a precedence number could be a possibility).
the vba routine would need to find the records with target date range value and insert your data lookup into the cell in column E
 
Upvote 0
You can't have both values and formulas in the same cells. (Column E).
to do what you ask dynamically you would need a vba routine to somehow figure out the highest precedence of the date ranges (A lookup array that would entail many year ranges with a precedence number could be a possibility).
the vba routine would need to find the records with target date range value and insert your data lookup into the cell in column E
Is it something you can help with? If you could write array formula or vba code?
 
Upvote 0
I am not skilled in vba and much more elegant and efficient solutions can be presented by other here.
I can offer a clunky solution with two additional columns (one hidden, one with formulas). And you would have to copy/paste as values from one column to another.
So it would not be very dynamic.
 
Upvote 0
Would a separate cell outside of your data range (where you manually select the current financial year), that drives the formula in column E, be acceptable? You can then use an IF statement in column E, as you outlined.

James.
 
Upvote 0

Forum statistics

Threads
1,214,641
Messages
6,120,693
Members
448,979
Latest member
DET4492

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