Quantcast
Channel: Excel IT Pro Discussions forum
Viewing all articles
Browse latest Browse all 11829

[Forum FAQ] Use formula to find matching data in Excel

$
0
0

Microsoft Excel providevarious built-in functions to let user find matching data or get the relative position of that item. Also we can do a further processing for matched data.
For different scenarios, you can use different formulas to find the matching data. Here we list several common functions and scenarios.

Function 1:FIND & SEARCH

The FIND and SEARCH functions locate one text string within a second text string, and return the number of the starting position of the first text string from the first character of the second text string.

The syntax for the Microsoft Excel FIND function is:

FIND(find_text, within_text, [start_num])

Find_text   Required. The text you want to find.

Within_text   Required. The text containing the text you want to find.

Start_num   Optional. Specifies the character at which to start the search. The first character in within_text is character number 1. If you omit start_num, it is assumed to be 1.

The syntax for the Microsoft ExcelSEARCH function is:

SEARCH( substring, string, [start_position] )

substring is the substring that you want to find.
string is the string to search within.
start_position is optional. It is the position in string where the search will start. The first position is 1.

Remarks:

  1. FIND is case-sensitive, SEARCH is case-insensitive.
  2. FIND doesn’t allow wildcard characters. Wildcards can be used in SEARCH Function, Like (?), (*) .A question mark (?) matches exactly one character. An asterisk (*) matches a series of zero or more characters.

http://office.microsoft.com/en-us/starter-help/find-findb-functions-HP010342526.aspx?CTT=1

http://office.microsoft.com/en-us/starter-help/search-searchb-functions-HP010342873.aspx?CTT=1

Example:Find a specific symbol or letter

You can use the following formulas to know if there are any commas (,) in columns A-C,

=IFERROR(FIND(",",A1&B1&C1),"NO")
Or

=IFERROR(SEARCH(",",A1&B1&C1),"NO")

Reference thread:
http://social.technet.microsoft.com/Forums/en-US/889a66d6-c09a-47c5-b74e-bea05fbfa1f5/find-a-specific-symbol-or-letter?forum=excel


Function 2:LOOKUP & VLOOKUP & HLOOKUP

LOOKUP function returns a value either from a one-row or one-column range or from an array.
VLOOKUP searches for a value in the leftmost column of a data range, and then returns a value in the same row from a column you specify in the range.
HLOOKUP is the exact same function, but looks up data that has been formatted by rows.

The syntax for the Microsoft ExcelLOOKUP function is:

LOOKUP( value, array )

valueis the value to search for in the array. The values must be in ascending order.

arrayis an array of values that contains both the values to search for and return.

The syntax for the Microsoft ExcelVLOOKUP function is:

VLOOKUP( value, table_array, index_number, [not_exact_match] )

valueis the value to search for in the first column of thetable_array.

table_arrayis two or more columns of data that is sorted in ascending order.

index_numberis the column number intable_array from which the matching value must be returned. The first column is 1.

not_exact_matchis optional. It determines if you are looking for an exact match based onvalue. Enter FALSE to find an exact match. Enter TRUE to find an approximate match, which means that if an exact match if not found, then the VLOOKUP function will look for the next largest value that is less thanvalue. If this parameter is omitted, the VLOOKUP function returns an approximate match.

Remarks:

  1. The LOOKUP function is used to finds a value in a single row or column
  2. The VLOOKUP function is used when data is listed in columns, can only perform a left-to-right lookup
  3. The HLOOKUP function is used when data is listed in rows

http://office.microsoft.com/en-001/excel-help/lookup-function-HP010342671.aspx

http://office.microsoft.com/en-001/excel-help/vlookup-HP005209335.aspx

Example 1:Get data from another sheet

You can use the following formula to get the match value from another worksheet
=VLOOKUP(A2, Sheet2!$A$2:$B$10, 2,0)

Reference thread:
http://social.technet.microsoft.com/Forums/en-US/56a97700-c8a4-4ac8-a20e-f148a1e430db/get-number-from-other-sheet?forum=excel

Example 2:VLOOKUP with multi criteria using array

You can use the following formula to perform a multiple value match
= {VLOOKUP(C1&E1,IF({1,0},Sheet3!A1:A5&Sheet3!E1:E5,Sheet3!J1:J5),2,0)}

Reference thread:
http://social.technet.microsoft.com/Forums/office/en-US/50c156c8-288b-472a-94ad-0507e87f4b4d/vlookup-with-multi-criteria-using-array?forum=excel

Example 3:COUNTIF and VLOOKUP

You can use the following formulas to Sum the results of matched data
{=SUM(LOOKUP($J$2:$J$101,CODES!$A$2:$B$42))}

Or
=SUM(VLOOKUP(T(IF({1},$A1:$A6)),CODES!A1:B3,2,0))

Referenced Thread:
http://social.technet.microsoft.com/Forums/office/en-US/8d958dff-b8ee-49ba-a4fa-259d6f1c04d6/countif-and-vlookup?forum=excel

Function 3:INDEX & MATCH

INDEX function returns a value or the reference to a value from within a table or range, the MATCH function searches for a specified item in a range of cells, and then returns the relative position of that item in the range.

The syntax for the Microsoft ExcelINDEX function is:

INDEX( array, row_number, [column_number] )

arrayis a range of cells or table.

row_numberis the row number in the array to use to return the value.

column_numberis optional. It is the column number in the array to use to return the value.

The syntax for the Microsoft ExcelMATCH function is:

MATCH( value, array, [match_type] )

valueis the value to search for in thearray.

arrayis a range of cells that contains thevalue that you are searching for.

match_typeis optional. It the type of match that the function will perform. The possible values are:

Remarks:

Usually use the INDEX and MATCH functions together to get the same results as using LOOKUP orVLOOKUP, can perform a right-to-left lookup.

http://office.microsoft.com/en-001/excel-help/index-function-HP010342608.aspx

http://office.microsoft.com/en-001/excel-help/match-function-HP010062414.aspx

Example:VLOOKUP can only search the first column

Use INDEX and MATCH function to perform a right–to-left lookup
=INDEX($I$1:$I$6,MATCH(A3,$J$1:$J$6,0))

Or
=
VLOOKUP(A2,IF({1,0},$J$1:$J$6,$I$1:$I$6),2,0)

Referenced Thread:
http://social.technet.microsoft.com/Forums/en-US/d9097ba8-7e3d-4ef7-985e-0ebd1a9cee15/vlookup-can-only-search-the-first-column?forum=excel






Viewing all articles
Browse latest Browse all 11829

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>