Calc: search a text and show row content

First, difference between SEARCH, MATCH, INDEX, LOOKUP, FIND?

There is a list of countries with coronavirus cases, deaths for example.
with a calc function i want to search a country name and show the row data.
in other words, Returning contents of row with a function if specific text is found in a data range.

i searched only for hours and nothing.

1 Like
  • SEARCH() will search for specific text content within a text string (often from a referenced cell), irrespective of case. If found, it returns the position (character number) within the searched cell where the search term starts. If search term is not found, the function returns an error. If regular expressions are enabled for formulas, valid regex patterns in search term will be expanded.
  • MATCH() Will search for a specific value within a “vector” (one dimensional range of cells) and return the position of the (best) match. Also returns an error if there is no suitable match. Nature of search depends on value/presence of optional third parameter.
  • INDEX() will pick a specific element from a two dimensional range, specified by row and column coordinate within the range.
  • LOOKUP() will search for a specific value within a sorted vector, and return the best match. If the optional second range is specified, the returned value will be from the corresponding position in that “result vector”. If search vector is unsorted, the result of this function is not predictable.
  • FIND() is similar to SEARCH(), but searches for exact text as specified (case sensitive, and does not expand regex).

If the search field is the first column of your table and there is a single nation/region name in each cell, the VLOOKUP() function may be the simplest choice. Otherwise, LOOKUP() is good as long as key is sorted in the table. If not, use an INDEX()/MATCH() combination with third parameter of MATCH() set to zero (meaning “unsorted” and hence also requiring exact match). See the help for how to use the functions, or show us your data structure if you want more specific advice.

Remember that matrix formulas must be introduced with [Ctrl+Enter], if not only the first cell in the range it’s showed.

1 Like