View Single Post
 
Old 07-23-2014, 11:42 AM
gebobs gebobs is offline Windows 7 64bit Office 2010 64bit
Expert
 
Join Date: Mar 2014
Location: Atlanta
Posts: 837
gebobs has a spectacular aura aboutgebobs has a spectacular aura about
Default

Good grief, my bad. Simple error. We need to use absolute references for the lookup table.
The current equation in D2...

=VLOOKUP(B2,Balances!A2:B21,2,FALSE)

Excel automatically increments references so the lookup table then is A3:B22 for the equation
in the next row, A4:B23 after that, etc. Making the reference absolute, the equation becomes...

=VLOOKUP(B2,Balances!$A$2:$B$21,2,FALSE)

What this does is tell Excel to not increment either the row or column reference. Since we are
copying down, all we really care about is the row reference so we could just put the $ in front
of that part: A$2:B$21. Or, more simply...

=VLOOKUP(B2,Balances!A:B,2,FALSE)

This makes the entire columns A and B the lookup reference and thus leaves room for you to
add rows nearly indefinitely (over one million rows in Excel 2010).

Also, we can add error trapping (use this equation)...

=IFERROR(VLOOKUP(B2,Balances!A:B,2,FALSE),"")

In summary, what this says is:

* If there's any error in the equation (e.g. if there's not balance date found that matches the bill date),
then just leave a blank space, "".
* Otherwise, take the bill date.
* Look for it in the Balances table.
* When you find it, get the balance in the 2nd column.
* It must be an exact match (the FALSE specifies this).
Reply With Quote