excel vba - LookupConcat in Google Script -
i'm trying re-create xls macro in google script. macro works in xls not working in google sheets. i'm trying apply vlookup , concat functions together.
i'm getting error message:
missing ; before statement. (line 1, file "code")
here below i'm using:
function lookupconcat(byval searchstring string, searchrange range, returnrange range, _ optional delimiter string = " ", optional matchwhole boolean = true, _ optional uniqueonly boolean = false, optional matchcase boolean = false) dim x long, cellval string, returnval string, result string if (searchrange.rows.count > 1 , searchrange.columns.count > 1) or _ (returnrange.rows.count > 1 , returnrange.columns.count > 1) lookupconcat = cverr(xlerrref) else if not matchcase searchstring = ucase(searchstring) x = 1 searchrange.count if matchcase cellval = searchrange(x).value else cellval = ucase(searchrange(x).value) end if returnval = returnrange(x).value if matchwhole , cellval = searchstring if uniqueonly , instr(result & delimiter, delimiter & returnval & delimiter) > 0 goto continue result = result & delimiter & returnval elseif not matchwhole , cellval "*" & searchstring & "*" if uniqueonly , instr(result & delimiter, delimiter & returnval & delimiter) > 0 goto continue result = result & delimiter & returnval end if continue: next lookupconcat = mid(result, len(delimiter) + 1) end if end function
Comments
Post a Comment