excel - How to use VLOOKUP result as COUNTIF criteria -
i want able determine how many times person's particular id (e.g. #123) has appeared in separate column (e.g. column c) given name (e.g. bob).
i have:
- let column consist of several names. (
bob)- let column b consist of ids relating person's name. (
#123)- let column c consist of same ids, may contain duplicates of ids (might have 3
#123s)
the ids side-by-side each person's respective name.
how can use result of vlookup criteria (second argument) of countif function?
if use vlookup separately returns correct value i'm trying count. =vlookup(bob, column a:column b, 2, false) return #123
if use countif separately returns correct count value well. =countif(column c, #123) return 3
i've tried =countif(column c, vlookup(bob, column a:column b, 2, false)) returns 0.
i've tried referring criteria countif separate cell vlookup formula still returns 0.
so seems stops working when combine 2 together. might problem be, , might alternative?
@steve martin has valid point, assuming bob text, formula correct though syntax should be:
=countif(c:c,vlookup("bob",a:b,2,0)) if using , returning 0 rather correct result reason #123 in columnb not same #123 in columnc. (in turn, reason 1 or more trailing spaces - not show on inspection of cells in columnsb:c).
to check, copy 1 of #123s columnc on top of first #123 in columnb right of bob. should see result greater 0 "on right track" , may want apply trim remove surplus spaces.
in short, vlookup attempts match actual cell content rather visible cell content , recognises difference between #123 , #123 though not display 2 differently.
Comments
Post a Comment