Xlookup Formula Issue

Sundance_Kid

Board Regular
Joined
Sep 2, 2017
Messages
155
Office Version
  1. 365
Platform
  1. Windows
Hi,
I am trying to use a formula to return the year based on a date, and if the date is not within the range in the lookup table I want it to return the word "Problem". However, I have two dates out of five which should not fall between the dates in the table, yet only one is returning "Problem".

So, I clearly have entered something wrong. Please see below.

Any ideas?

Xlookup Issue.png
 

Excel Facts

Which lookup functions find a value equal or greater than the lookup value?
MATCH uses -1 to find larger value (lookup table must be sorted ZA). XLOOKUP uses 1 to find values greater and does not need to be sorted.
Hello, Excel is working properly here because you picked up -1 as the match mode, i.e. exact match or next smallest which is 2024. So, how about using:

Excel Formula:
=XLOOKUP(YEAR(J5:J9),F7:F11,F7:F11,"problem")
 
Upvote 0
Hello, Excel is working properly here because you picked up -1 as the match mode, i.e. exact match or next smallest which is 2024. So, how about using:

Excel Formula:
=XLOOKUP(YEAR(J5:J9),F7:F11,F7:F11,"problem")
Thanks, yep I didn't think excel was doing anything wrong but more my formula was not accurate.

Ok, so -1 pulling next smallest makes sense then.

Not sure your formula is working either, I am trying to return the value to cells J5 to J9.

Also, where it is taking the value from the cells F7 to F11, it may not always be a year, it may say Quarter 4 or something else, so not sure is the Year part of the formula required?
 
Upvote 0
My apologies, it should be I5:I9 instead of J. As for the latter question, what possible values are there - could you post some examples?
 
Upvote 0
My apologies, it should be I5:I9 instead of J. As for the latter question, what possible values are there - could you post some examples?
Hi, your formula still doesnt seem to work.

As an aside in the column where it says year, if I decide to put something like a text instead of the year, I would want that returned.
 
Upvote 0
Alright, how about this then:

Excel Formula:
=FILTER($F$7:$F$11,($D$7:$D$11<=I5)*($E$7:$E$11>=I5),"problem")
 
Upvote 0

Forum statistics

Threads
1,221,310
Messages
6,159,173
Members
451,543
Latest member
cesymcox

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