In debugging a problem I found in a workbook I've created, I isolated the issue to the results that VLOOKUP are returning.
I have a simple table against which I lookup a value and then do a calculation based on the values in adjacent columns.
I've created the results I desire perfectly within cells on the spreadsheet. However, when I transfer the same formulas to VBA to have the work performed as a macro, I do not get the same results around the edges of my data.
The table is incremented from zero to 1,000,000 in various steps. In the VBA version, any lookup value less than 100,000 or greater than 950,000 does not return the same results as the formulas in the spreadsheet cells.
It's my undertadning that when the 4th element of VLOOKUP is omitted, that the next closest value that is less than the lookup value is returned. Within VBA, this doesn't happen when the lookup value is between the first and second value, or the second to last and last value in my list. But it does when used as formula in a cell.
I'm stumped! Please see the attached file for an example. It demonstartes the cells doing the formulas, and below that the result VBA returns doing the same work.
Any advice?
Thanks,
Shred
Bookmarks