is there anyway return multiple values vlookup? col in sheet 1 return multiple values cell, or there way of displaying (would rather not pivot)?
sheet 1 : has unique values (col f, , returning values in col i),
sheet 3: col has duplicate string values correspond unique strings in col b unique, including blanks.
edit
sheet 1 or desired result :
sheet 1: current
sheet 3 current:
current formula
=vlookup(f2,sheet3!a:b,2,false)
returns 0's, due blanks or multiple values corresponding unique values.
in terms of vba then, have change code bit in link sent you. should work:
option explicit function vlookupmulti(rnglookup variant, rngsource range, col double) string dim d double, strcell string 'error if range has less columns col if rngsource.columns.count < col vlookupmulti = cverr(xlerrna) exit function end if 'loop through rows in lookup column d = rngsource.row rngsource.rows.count if rnglookup = sheets(rngsource.parent.name).cells(d, rngsource.column).value strcell = sheets(rngsource.parent.name).cells(d, rngsource.column + col - 1).value if len(strcell) > 0 vlookupmulti = vlookupmulti & strcell & ", " end if next d 'remove comma @ end if right(vlookupmulti, 2) = ", " vlookupmulti = left(vlookupmulti, len(vlookupmulti) - 2) end if 'give error if no results if vlookupmulti = "" vlookupmulti = cverr(xlerrna) end if end function
Comments
Post a Comment