Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.misc
|
|||
|
|||
![]()
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
![]()
Posted to microsoft.public.excel.misc
|
|||
|
|||
![]()
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
![]()
Posted to microsoft.public.excel.misc
|
|||
|
|||
![]()
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 |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
COUNTIF and VLOOKUP | Excel Worksheet Functions | |||
countif w/vlookup | Excel Discussion (Misc queries) | |||
vlookup and countif??? | Excel Worksheet Functions | |||
Countif or Vlookup | Excel Worksheet Functions | |||
Countif? or Vlookup? Lost?? | Excel Worksheet Functions |