#1   Report Post  
Posted to microsoft.public.excel.misc
pol pol is offline
external usenet poster
 
Posts: 129
Default countif and Vlookup

I given the following formula

IF(COUNTIF([item.xls]sheet1!A:C,G7),TRUE,FALSE) , the result is showing as
true if the record exist in item.xls . At the same time I wrote another
VLOOKUP(G7,[item.xls]sheet1!A:C,3,0) the result is showing as '#NA' for the
same record which already showed as true in Countif .

Please anybody can help me to get the reason for the diffrent result in
both function;.


  #2   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 2,722
Default countif and Vlookup

VLOOKUP is looking for G7 in only column A (as this is the nature of how
VLOOKUP works). Your COUNTIF is looking at all 3 columns, A:C. So, if G7 is
found in C6, your first formula is true, but it causes an error in the
VLOOKUP. A better check would be to limit your COUNTIF to just A:A.
--
Best Regards,

Luke M
*Remember to click "yes" if this post helped you!*


"pol" wrote:

I given the following formula

IF(COUNTIF([item.xls]sheet1!A:C,G7),TRUE,FALSE) , the result is showing as
true if the record exist in item.xls . At the same time I wrote another
VLOOKUP(G7,[item.xls]sheet1!A:C,3,0) the result is showing as '#NA' for the
same record which already showed as true in Countif .

Please anybody can help me to get the reason for the diffrent result in
both function;.


  #3   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 5,939
Default countif and Vlookup

Countif treats everything as text. That makes it very valuable when doing
lookups or matches. The reason is that countif will let you know if you have
a data type mismatch (quite possibly what you have). That is you are looking
up a number in values stored as text or vice versa. I personally always use
countif with my lookups or matches...

if(countif(...) 1, "multiple values", if(countif(...) = 0, "not Found",
Lookup/match)

This is relatively foolproof. If it counts multiple values then it returns
"multiple values". If it count none then it returns "not found". If it return
#N/A then I know that the value exists but that I have a data type mismatch.
--
HTH...

Jim Thomlinson


"pol" wrote:

I given the following formula

IF(COUNTIF([item.xls]sheet1!A:C,G7),TRUE,FALSE) , the result is showing as
true if the record exist in item.xls . At the same time I wrote another
VLOOKUP(G7,[item.xls]sheet1!A:C,3,0) the result is showing as '#NA' for the
same record which already showed as true in Countif .

Please anybody can help me to get the reason for the diffrent result in
both function;.


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
COUNTIF and VLOOKUP mpenkala Excel Worksheet Functions 3 April 10th 08 10:20 PM
countif w/vlookup sjl Excel Discussion (Misc queries) 2 February 16th 07 03:05 PM
vlookup and countif??? Joe Excel Worksheet Functions 5 March 13th 06 10:33 AM
Countif or Vlookup praveen_khm Excel Worksheet Functions 1 February 3rd 06 08:17 PM
Countif? or Vlookup? Lost?? leo Excel Worksheet Functions 3 November 30th 05 02:17 PM


All times are GMT +1. The time now is 12:05 AM.

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

About Us

"It's about Microsoft Excel"