excel - How to check in another table if an agency is in a specific region -
there many travel agencies each code of 3 characters in column. want know if travel agency in atlantic canada. can list of codes corresponding travel agencies in atlantic canada database , put them in single column in worksheet in same excel file, i'm not sure of exact syntax writing if ...lookup or if there better excel formula/technique.
if codes in d2:d68 in example, want column e (e2:e68) if value in column d corresponds 1 of lengthy list of codes. column e display yes/no or true/false or similar.
i've been looking @ various tutorials. don't want anything, want yes/no or true/false three-character code 1 of, or not 1 of, many atlantic canada codes.
suggestions?
if reference list in in columna of sheet 2, try =vlookup(d2,sheet2!a:a,1,false)
in e2
copied down required. adapted show true/false identification purposes code repeat seems adequate. false accept match when exact (true allow approximate matches - ie similar not correct). ones not match display#name?
edit
for t/f results
=iferror(if(match(d1,'atlantic canada codes'!a:a,0)>0,"true","false"),"false")
should work (though less inelegant seems possible!)
edit re apparent inconsistency in formulae results mentioned in comment
=trim()
(worksheet) ,trim
(vba) behave differently.=match
,=v / h lookup()
may behave differently according whether exact or otherwise.- a space character may ‘normal’ (7-bit ascii code 32) or non-breaking (  code 160).
rather cover these combinations, simplified (so far complete) explanation ‘extra’ spaces problem, trailing ones, apply =trim()
both data looked (ie key) , @ least part of array (the keys) relate required results.
it possible apparent inconsistency mentioned in comment arose because something+space
not matching something
, in removing +space
something+space
same applied somethingelse+space
. hence before =trim() somethingesle+space
matching somethingelse+space
after somethingelse
no longer matching somethingelse+space
.
that problem switched 'surplus' spaces in 1 list 'surplus' spaces in other. either have these spaces in neither, or if must, in both.
Comments
Post a Comment