VLOOKUP and IF
By combining the date and account to create a unique key you should be able
to preform your lookup on this key - you mention a matching of the date and
then performing a lookup once the date matches. What I was suggesting factors
into account that you will have many dates/many accounts i.e. you will have
account ABC for 5/10/06, ABC for 6/10/06 and so on. You will also have
account DEF for 5/10/06, DEF for 6/10/06 and so on (your data workbook).
By adding in this extra column (combining date and account), you can look
for a match in your output workbook/worksheet on date & account i.e. where
both date and account match, return the value.
This has limitations - if there are several instances meeting the criteria,
Excel will return the first match e.g. you may have a balance for account ABC
on 5/10/06 and may have another balance further down the list for account ABC
for 5/10/06(this may not happen but thought that I'd mention it).
Not knowing what is in each of your cells I have to take a guess here, but,
this is what your formula is doing:
=IF((C12<'Workbook1'!A6),VLOOKUP(D12,'Workbook2'! $A:$D,3,FALSE))
If the value in cell C12 is NOT equal to the value in cell A6 in workbook1
then perform a lookup on the value held in cell d12 (looking at columns A to
D in Workbook 2, returning the value in the 3rd column or else returning an
error).
You said that you wanted to match a date and account - I'm not sure how
checking if cell C12 is not equal to cell A6 in workbook 1 achieves this??? I
appreciate that cell D12 probably contains your account number, column A:D on
workbook 2 contain dates/accounts/values so your lookup formula is correct in
that it will return the value in column C when the account number is matched
(this could be the date - I'm guessing) - I think it is the first part of
your if statement that's got to be causing you to get the wrong (or no)
result.
Does this help?
"Dr Phibes" wrote:
Hi,
Thanks, but maybe I should have posted what I currently have.
=IF((C12<'Workbook1'!A6),VLOOKUP(D12,'Workbook2'! $A:$D,3,FALSE))
There will be many of the same date (C12) but I need the V Lookup to make
sure the date matches as there may be many of theaccount number (D12)
Hope this makes things clearer
|