Advertisement
zilexa

EXCEL - Lookup value in a secondary list and return match

May 19th, 2016
138
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.02 KB | None | 0 0
  1. Google Sheets
  2. =============
  3. QUERY(Sheet1!A$2:C, "Select A Where C contains '"&$F2&"'",-1)
  4. QUERY(Sheet1!A$2:C, "Select A Where C matches '"&$F2&"'",-1)
  5. QUERY(Sheet1!A$2:C, "Select A Where C='"&$F2&"'",-1)
  6. The best Vlookup alternative. This uses Google Query tech.
  7. It will return all matches in seperate cells.
  8.  
  9. QUERY(Sheet1!A$2:C, "Select A Where C matches '"&$F2&"' limit 2",-1)
  10. This will limit the output to 2 matches.
  11.  
  12. =join(", ",(QUERY(Sheet1!A$2:C, "Select A Where C matches '"&$F2&"' limit 1",-1)))
  13. This will put all output in the same cell, comma separated.
  14.  
  15.  
  16.  
  17.  
  18. EXCEL
  19. =====
  20. =IF(ISNUMBER(SEARCH("abc",B5)),"return if B5 partially or fully contains text abc","no match")
  21.  
  22. Return multiple values:
  23. =IF(ISNUMBER(SEARCH("vpaid",E3)),"VPAID",IF(ISNUMBER(SEARCH("VAST4",E3)), "VAST4", "-"))
  24.  
  25. Recommended (it will return the last found match):
  26. =IFERROR(LOOKUP(2,1/SEARCH(Publishers,B2),Publishers),"Other")
  27. Publishers is a named range, you can also use for example E2:E50.
  28. Others is the value shown when no match was found in the Publishers list.
  29.  
  30. The same but with an Array Formula (I saw the same result in every cell so it did not work for me):
  31. =INDEX(Publishers,MATCH(TRUE,ISNUMBER(SEARCH(Publishers,K2)),0))
  32.  
  33. A very manual solution:
  34. =IF(K2="300x250","Desktop standard",IF(K2="336x280","Desktop standard",IF(K2="728x90","Desktop standard",IF(K2="468x60","Desktop standard",IF(K2="120x600","Desktop standard",IF(K2="160x600","Desktop standard",IF(K2="300x600","Halfpage",IF(K2="970x250","Billboard",IF(K2="120x90","Floorad",IF(K2="970x500","Fishtank",IF(K2="2x4","Skin", IF(K2="8x8","HPTO",IF(K2="1x1","HPTO","Other")))))))))))))
  35.  
  36.  
  37. =IF(K2="SmartClip","Desktop standard",IF(K2="336x280","Desktop standard",IF(K2="728x90","Desktop standard",IF(K2="468x60","Desktop standard",IF(K2="120x600","Desktop standard",IF(K2="160x600","Desktop standard",IF(K2="300x600","Halfpage",IF(K2="970x250","Billboard",IF(K2="120x90","Floorad",IF(K2="970x500","Fishtank",IF(K2="2x4","Skin", IF(K2="8x8","HPTO",IF(K2="1x1","HPTO","Other")))))))))))))
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement