Excel bug/feature: recursive VLOOKUP for hierarchy calculations
8:32 PMThere's lots of Q&A websites out there talking about Excel bugs that are actually formula errors, and others that talk about recursive VLOOKUPs when they really mean iterative. To be clear on what we are talking about:
Excel (2007, 2010, 2011) has an undocumented feature where you can use circular reference in the third argument of VLOOKUP without iterative calculation.
Why should I care?Here's one type of problem you can solve with this "feature". Suppose we have an organizational chart and want to find how many levels deep each person is. Similar to this problem posted on MrExcel.
So what's going on here? For the first row, we have a cop-out, this rule makes LEVEL = 1 for John Smith who has no boss. For the second row VLOOKUP finds Susan's boss and then looks up John's LEVEL and adds one.
So that's cute, since the order of operations by default goes from top to bottom, Excel will evaluate the rows above it and find the needed value, right? Wrong. Excel will set its execution order correctly to account for the problem.
Now... what if you enter a value that is a legitimate circular reference?
In 2007 and 2010 calculation is halted without an error. In Excel 2011, this throws an error correctly.