#1   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 96
Default vlookup

I have two worksheets: the main worksheet has all the employees with the
employee number in column A sorted ascending and years of service in col D.
The workbrain worksheet has employee numbers in A and my formula in G which
is:

vlookup(a2,main!a2:d1491,4)
the information is correct that is returned, but I have employees that is on
the workbrain sheet and not on the main, and it is pulling in 10.75 on these
10 cells. Is there a way to add to my formula that if it doesn't find that
emp # to bring in a 0?
  #2   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 11,501
Default vlookup

Pammy,

Try this

=IF(COUNTIF(Main!A2:A1491,A2)=0,"Lookup Not
Found",VLOOKUP(A2,Main!A2:D1491,4,FALSE))

or to return Null

=IF(COUNTIF(Main!A2:A1491,A2)=0,"",VLOOKUP(A2,Main !A2:D1491,4,FALSE))

Mike



"Pammy" wrote:

I have two worksheets: the main worksheet has all the employees with the
employee number in column A sorted ascending and years of service in col D.
The workbrain worksheet has employee numbers in A and my formula in G which
is:

vlookup(a2,main!a2:d1491,4)
the information is correct that is returned, but I have employees that is on
the workbrain sheet and not on the main, and it is pulling in 10.75 on these
10 cells. Is there a way to add to my formula that if it doesn't find that
emp # to bring in a 0?

  #3   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 9
Default vlookup

Yes, change your formula as follows:

=IFERROR(VLOOKUP((a2,main!a2:d1491,4,FALSE),0)

"Pammy" wrote:

I have two worksheets: the main worksheet has all the employees with the
employee number in column A sorted ascending and years of service in col D.
The workbrain worksheet has employee numbers in A and my formula in G which
is:

vlookup(a2,main!a2:d1491,4)
the information is correct that is returned, but I have employees that is on
the workbrain sheet and not on the main, and it is pulling in 10.75 on these
10 cells. Is there a way to add to my formula that if it doesn't find that
emp # to bring in a 0?

  #4   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 15,768
Default vlookup

vlookup(a2,main!a2:d1491,4)

Try using the 4th argument and setting it to either 0 or FALSE;

=VLOOKUP(A2,main!A$2:D$1491,4,0)

=VLOOKUP(A2,main!A$2:D$1491,4,FALSE)

Another possible method:

=SUMIF(main!A$2:A$1491,A2,main!D$2:D$1491)

--
Biff
Microsoft Excel MVP


"Pammy" wrote in message
...
I have two worksheets: the main worksheet has all the employees with the
employee number in column A sorted ascending and years of service in col
D.
The workbrain worksheet has employee numbers in A and my formula in G
which
is:

vlookup(a2,main!a2:d1491,4)
the information is correct that is returned, but I have employees that is
on
the workbrain sheet and not on the main, and it is pulling in 10.75 on
these
10 cells. Is there a way to add to my formula that if it doesn't find
that
emp # to bring in a 0?



Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
VLookUp - Does the VLookUp return the exact information? Cpviv Excel Worksheet Functions 2 October 28th 08 09:57 AM
Vlookup in vlookup - taking the result as array name SupperDuck Excel Worksheet Functions 2 June 2nd 07 11:05 AM
Combine VLOOKUP and IF function so #NA isn't returned as a value from VLOOKUP buffgirl71 Excel Discussion (Misc queries) 12 November 14th 06 11:36 PM
Vlookup -=VLOOKUP(F9,LookUp1!$A$2:$B$1504,2,FALSE) MikeR-Oz New Users to Excel 1 March 22nd 06 09:01 AM
Vlookup info being used without vlookup table attached? Excel Worksheet Functions 0 January 25th 05 10:43 AM


All times are GMT +1. The time now is 08:03 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"