First Sorry for the bad English.
I have a data with A, B, and date.(For exampe name, salary)
I want to search B based on A, but here’s the problem.
There are multiple Bs matched to A, and since xlookup brings the first match, sometimes it brings wrong data.
Thankfully, my data is sorted by date. And so this is what I want to do.
Jason 1000 06-03
Jason 1200 06-05
If I search by [Jason, 06-04], I want to bring the first data after the date, in this case 1200.
My fisrt idea was to use xlookup and logical multiplication.
=arrayformula(xlookup(1, (name_range=name)*(date_range>date), salary_range, ...))
something like this.
This worked perfectly, but the problem was this was sooo slow. My data is pretty big(over 5000), so I needed faster formula.
My second idea was to change the the search range by date. I needed indirect and address to do this.
=xlookup($H3,indirect("sheet!"&address(match(floor($A3),sheet!$C:$C,1),9)&":I"),
indirect("sheet"&address(match(floor($A3),sheet!$C:$C,1),7)&":G"), ...)
column A : date, column H : name,
sheet!I : name, sheet!C : date, sheet!G: salary
This is not so bad, but I’m little uncomfortable with indirect-address, and I want to change this to arrayformula but I can’t do it because the range of xlookup is changing.
Do you have any better solution for this?
Lunartown is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.