Thread: VLOOKUP and IF
View Single Post
  #3   Report Post  
Posted to microsoft.public.excel.worksheet.functions
Boo Boo is offline
external usenet poster
 
Posts: 21
Default VLOOKUP and IF

Hi,

First things first - what I think you are trying to do is return a value
from sheet 1 into sheet 2 when a date criteria is matched. This means that
your formula should be in sheet 2 and not in sheet 1.

Second, I'm assuming that you want to return the value from sheet 1when both
the account & date matches. If your data is as follows:

Sheet 1:
Column 1 = Date
Column 2 = Account
Column 3 = Amount

Sheet 2:
Column 1 = Date
Column 2 = Account
Column 3 = Formula to pick up amount from sheet 1 when the first 2 criteria
are met

A VLOOKUP function is only useful for matching a criteria and then returning
a corresponding value. What you are trying to do is match 2 criteria (date &
account).

I would suggest the following:

Insert a column 3 in sheet 1. Make this column a concatenation of columns 1
& 2
e.g.
If A1 = 06/10/2006
& B1 = ABC Account
Then insert a column in C with formula =A1&B1 to get "06/10/2006ABC Account"

You now have a unique key.

In sheet 2, insert another column C & enter the same formulas i.e. combine
the date and account.

The last step is then to input your formula in sheet 2. You want to match
column C (date & account) with column c in sheet 1 (also date and account) &
return the value. Formula becomes:

VLOOKUP (Cell where the value you want to lookup is, Range in Sheet 1,
column containing the information you want to return,false)

E.g.

VLOOKUP (C1, Sheet1! C1:D500, 2, false) - the false bit tells if there are
no matches (produces an N/A! result).

Hope this helps.

"Dr Phibes" wrote:

Hi,

I have 2 worksheets

I need to build a VLOOKUP on worksheet 1 which will check a cell in
worksheet 1 , check that it matches a cell in worksheet 2. Then run a VLOOKUP
in sheet 1 to use against a seperate cell in sheet 2

Basically. I need the dates to match before the vlookup runs.

I'm getting hopelessly bogged down.

Can anyone help