Your first session is always free.Īre you still looking for help with the IF function? View our comprehensive round-up of IF function tutorials here. Still need some help with Excel formatting or have other questions about Excel? Connect with a live Excel expert here for some 1 on 1 help. Combined with the IF function, VLOOKUP can perform more advanced lookups that help to analyze data more effectively. It is a very powerful lookup and reference function for looking up data. For a specified value, the function finds (or 'looks up') the value in one column of data, and returns the corresponding value from another column. According to this condition, the VLOOKUP then returns the corresponding price for the product.Įxcel has several very effective functions when it comes to lookup values in other columns. Vlookup (short for 'vertical' lookup) is a built-in Excel function that is designed to work with data that is organised into columns. The IF function checks if the value in cell F2 is Shop 1 or 2. Apply the formula to G2 by pressing Enter.To find the price of the product in cell E2: In this example, cells A1:C6 contains the price for products in two different shops. You can also use IF and VLOOKUP together to perform a lookup based on two values. You can set other text messages or even a 0 or blank ( “” ) as the output. The ISNA function checks if the result of the VLOOKUP is a #N/A error, and executes the corresponding IF condition. Press enter to apply the formula to cell E2.Assign the formula = IF(ISNA(VLOOKUP(D2,A2:B6,2,FALSE)),"Name not found",VLOOKUP(D2,A2:B6,2,FALSE)) to cell E2.To handle this error with your own custom message, you will nest the VLOOKUP and ISNA functions inside an IF function. The name Jason Williams does not exist in cells A2:A6. To find the sales, assign the formula = VLOOKUP(D2,A2:B6,2,FALSE) to cell E2. In the previous example, assign the value Jason Williams to cell D2. Handling errorsĪnother common use of IF function with VLOOKUP is to handle errors. All you need to do is to set the cell reference as the condition inside the IF function. You can also compare VLOOKUP results to cell values in a similar way. This will return the result No as Baron Wendal had sales of $2,350. Press Enter to apply the formula in cell E2.In the following example, based on the list in cells A1:B6, to find out if the name mentioned in cell D2 has a bonus which is based on sales over $2,500: IF and VLOOKUP are used together mostly to compare the results of VLOOKUP to another value. The following will present a more detailed overview of the uses of IF function with VLOOKUP. You can use IF and VLOOKUP together nesting the VLOOKUP function inside the IF function. To use the IF and VLOOKUP functions together you should nest the VLOOKUP function inside the IF function. IF and VLOOKUP functions are used together in multiple cases: to compare VLOOKUP results, to handle errors, to lookup based on two values. The IF function performs a logical test and returns one value for a TRUE result, and another for a FALSE result. It performs a row-wise lookup until a match is found. VLOOKUP is a powerful function to perform lookup in Excel.
#Excel vlookup how to#
Learn How to Combine IF Function with VLOOKUP