Table of Contents
The IF function in Excel allows users to set conditions and perform different calculations based on those conditions. When combined with the INDEX MATCH function, it becomes a powerful tool for retrieving data from a specific table or range. By using the IF function as the logical test and the INDEX MATCH function as the result, users can efficiently search for and retrieve data that meets certain criteria. This allows for more precise and dynamic data analysis in Excel.
Excel: Use IF Function with INDEX MATCH
You can use the following formula to combine the IF function with INDEX and MATCH in Excel:
=IF(B1="Mavs",(INDEX(A7:D9,MATCH("Guard",A7:A9,0),3)),IF(B1="Pacers",(INDEX(A13:D15,MATCH("Guard",A13:A15,0),3))))
This particular formula first checks if the value in cell B1 is equal to “Mavs” – if it is then it looks for “Guard” in the range A7:A9 and returns the value in column 3 of the range A7:D9.
However, if the value in cell B1 is “Pacers” then it looks for “Guard” in the range A13:A15 and returns the value in column 3 of the range A13:D15.
The following example shows how to use this formula in practice.
Example: Use IF Function with INDEX MATCH in Excel
Suppose we have two datasets that display various information about basketball players on two different teams:

Now suppose we would like to return the rebounds value for the Guard on either the Mavs or the Pacers team, depending on the team name that we type into cell B1.
To do so, we can type the following formula into cell B2:
=IF(B1="Mavs",(INDEX(A7:D9,MATCH("Guard",A7:A9,0),3)),IF(B1="Pacers",(INDEX(A13:D15,MATCH("Guard",A13:A15,0),3))))
The following screenshot shows how to use this formula in practice:

Since the value in cell B1 is set to “Mavs” the formula returns the rebounds value for the Guard from the Mavs dataset, which turns out to be 2.
If we change the value in cell B1 to “Pacers” then the formula will automatically update to return the rebounds value for the Guard from the Pacers dataset instead:

The formula now returns a value of 4, which represents the rebounds value for the Guard from the Pacers dataset.
The following tutorials explain how to perform other common tasks in Excel:
Cite this article
stats writer (2024). How can I use the IF function with INDEX MATCH in Excel?. PSYCHOLOGICAL SCALES. Retrieved from https://scales.arabpsychology.com/stats/how-can-i-use-the-if-function-with-index-match-in-excel/
stats writer. "How can I use the IF function with INDEX MATCH in Excel?." PSYCHOLOGICAL SCALES, 23 Jun. 2024, https://scales.arabpsychology.com/stats/how-can-i-use-the-if-function-with-index-match-in-excel/.
stats writer. "How can I use the IF function with INDEX MATCH in Excel?." PSYCHOLOGICAL SCALES, 2024. https://scales.arabpsychology.com/stats/how-can-i-use-the-if-function-with-index-match-in-excel/.
stats writer (2024) 'How can I use the IF function with INDEX MATCH in Excel?', PSYCHOLOGICAL SCALES. Available at: https://scales.arabpsychology.com/stats/how-can-i-use-the-if-function-with-index-match-in-excel/.
[1] stats writer, "How can I use the IF function with INDEX MATCH in Excel?," PSYCHOLOGICAL SCALES, vol. X, no. Y, ص Z-Z, June, 2024.
stats writer. How can I use the IF function with INDEX MATCH in Excel?. PSYCHOLOGICAL SCALES. 2024;vol(issue):pages.
