How to Use the CODE Function in Excel
One of the most useful functions in Excel and Google Sheets is the VLOOKUP function. This function is designed to locate a value in the first column of a table array and return a value in the same row from another specified column. It is especially handy for tasks such as retrieving product prices, accessing employee details, or correlating data across multiple sheets.
Basic Syntax
The basic syntax of the VLOOKUP function is:
=VLOOKUP(lookup_value, table_array, col_index_num, [range_lookup])
- lookup_value: The value you are searching for in the first column of the table array.
- table_array: The range of cells containing the data table. This range should include both the lookup column and the result column you wish to access.
- col_index_num: The number of the column in the table_array from which to fetch the value. Numbering starts at 1 for the first column, 2 for the second, and so on.
- range_lookup: Optional. Set to TRUE or leave blank for an approximate match. Set to FALSE for an exact match.
Example: Price Lookup
Consider you have a table where column A contains product names and column B contains their respective prices. You want to determine the price of a product called “Apple”.
Product | Price |
---|---|
Apple | 0.99 |
Orange | 1.25 |
To find the price of “Apple”, you would use the following formula:
=VLOOKUP("Apple", A2:B3, 2, FALSE)
This will return the price 0.99.
Example: Employee Information
Suppose you have a table with employee IDs in column A and names in column B. You need to find the name of the employee with ID 123.
Employee ID | Name |
---|---|
123 | John Doe |
456 | Jane Smith |
To locate the name of the employee with ID 123, use this formula:
=VLOOKUP(123, A2:B3, 2, FALSE)
This formula returns the name John Doe.
Mastering the VLOOKUP function can greatly enhance your ability to manage and analyze data in Excel and Google Sheets.
More information: https://support.microsoft.com/en-us/office/code-function-c32b692b-2ed0-4a04-bdd9-75640144b928