You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
VLOOKUP and HLOOKUP return the first match instead of the last one when RangeLookup = TRUE #1072
If RangeLookup is omitted or TRUE or not 0, the first row of DataSource is assumed to be sorted in ascending order, with smaller numbers before larger ones [...] The lookup will try to match an entry of value Lookup. If none is found the largest entry less than Lookup is taken as a match. From a sequence of identical values ≤ Lookup the last entry is taken.
Steps to reproduce
These tests fail:
it('VLOOKUP should return the last matching value if RangeLookup = TRUE',()=>{constengine=HyperFormula.buildFromArray([['1','a'],['2','b'],['2','c'],['2','d'],['2','e'],['=VLOOKUP(2, A1:B5, 2, TRUE())'],])expect(engine.getCellValue(adr('A6'))).toEqual('e')})it('HLOOKUP should return the last matching value if RangeLookup = TRUE',()=>{constengine=HyperFormula.buildFromArray([['1','2','2','2','5'],['a','b','c','d','e'],['=HLOOKUP(2, A1:E2, 2, TRUE())'],])expect(engine.getCellValue(adr('A3'))).toEqual('d')})
Activity
sequba commentedon Nov 17, 2022
Closing as released in HyperFormula 2.2.0