VBA xlookup issue

Viewed 45

I am trying to do a lookup on a column in which the values rise and fall. for example, they may go like this: 4,5,6,4,3,2,1,4,6,8,9,11,9,8.... So, if I was looking for a "3" value in the series, i want to know the 1st time in the series, 3 (or the next smaller number) will reappear. In the example, the 1st time would be item(5) in the list

I have been working with xlookup, vlookup, index/match, and none of them see capable of giving the correct result. I either get an error message, or I get the wrong value returned. Here are a few of the codes i have tried, unsuccessfully:

'nextDate = Application.WorksheetFunction.Match _
              (todayAspect, searchRng, -1)
             
 'nextDate = Application.WorksheetFunction.XLookup _
              (todayAspect, searchRng, returnRng, , -1))
             
 nextDate = WorksheetFunction.Index(Range("A4:A5908"), _
              WorksheetFunction.Match(todayAspect, Range("u4:u5908"), -1))

Anyone have any insight as to my mistake? Thanks in advance...

0 Answers
Related