Formula

Nishg

New Member
Joined
Jul 25, 2020
Messages
5
Office Version
  1. 365
Platform
  1. Windows
Please help me on below,

I need to pick the rate in column S for the dates listed in column D 23 to D 28.

Logic is, If the date is < 30/06 then year in the date
eg: 27/05/2014 year is 2014
If the date is > 30/06 then year plus 1
eg: 22/07/2016 year is 2017

Once I get that I need to may be VLOOK up column D to S and pick the rate in Column "S"

1626070276981.png
 

Excel Facts

Add Bullets to Range
Select range. Press Ctrl+1. On Number tab, choose Custom. Type Alt+7 then space then @ sign (using 7 on numeric keypad)
You can obviously use Index/Match or Xlookup as well but since you mentioned VLookup, start with these.

This assumes the formula is on Row 23
Excel Formula:
=VLOOKUP(IF(MONTH($D23)>6,YEAR($D23)+1,YEAR($D23)),$D$2:$S$18,16,FALSE)

If you want to, you can reduce this to the following:-
This relies on
MONTH($D23)>6 = TRUE = 1
MONTH($D23)>6 = FALSE= 0
Excel Formula:
=VLOOKUP(YEAR($D23)+(MONTH($D23)>6),$D$2:$S$18,16,FALSE)
 
Upvote 0
Sticking with vlookup, another way that should work
Excel Formula:
=VLOOKUP(YEAR(EDATE($D23,6)),$D$2:$S$18,16,0)
You can obviously use Index/Match or Xlookup as well
I think that we could probably come up with 101 ways to answer this question, Alex. As there are no duplicate years in D2:D18 Sumifs and other similar functions will also work, as would filter and probably a few other things.
 
Upvote 0

Forum statistics

Threads
1,214,985
Messages
6,122,605
Members
449,089
Latest member
Motoracer88

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