VLOOKUP with IF logic

R

Rae

How do you write the following IF statement using vlookup functionality? Can
I use vlookup function imbedded in an IF statement for this scenario or is
there another function to use?

Look for project number in another worksheet (tab) (within the same
workbook), if project is found (true) return the open date. Else if not
found return the comment "no project found". Open date is stored/defined as
<date,time>.

I think the IF statement with vlookup would be written in this manner but
it's not working for me.

=IF(VLOOKUP,B2,Sheet1!C2:C154,1,false),Sheet1!F2:F154,"no project found")

b2 = project number that vlookup is searching for on worksheet 1, range
c2:c154
sheet1!f2:f154 = is where the open date would be found if the project is
found on worksheet 1.


Thanks,
Rae
 
J

John C

I believe this will match what you need.

=IF(ISNA(VLOOKUP(B2,Sheet1!$C$2:$F$154,5,FALSE)),"No Project
Found",VLOOKUP(B2,Sheet1!$C$2:$F$154,5,FALSE))
 
P

Pete_UK

Try it this way:

=IF(ISNA(MATCH(B2,Sheet1!C$2:C$154,0)),"no project
found",VLOOKUP(B2,Sheet1!C$2:F$154,4,0))

Hope this helps.

Pete
 
M

Michael

Try this:

=IF(ISERROR(VLOOKUP(B2,Sheet1!C2:C154,1,FALSE)),"No Project Found",VLOOKUP
(B2,Sheet1!C2:C154,1,FALSE))
 
R

Rae

Thank you John, your example worked.
I just have to remember to change the cell format to date when it returns a
date instead of text.

Rae
 
J

John C

You could just include the formatting with it, like so:
=TEXT(IF(ISNA(VLOOKUP(B2,Sheet1!$C$2:$F$154,4,FALSE)),"No Project
Found",VLOOKUP(B2,Sheet1!$C$2:$F$154,4,FALSE)),"MM/DD/YY HH:MM AM/PM")
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads


Top