# Result of if statement use in another if statement

Copper Contributor

# Result of if statement use in another if statement

I would like to do the following:

select tools size from list, then if size A was selected Display following data.

in the next statement, use data from previous statement and compare value and display result

# Re: Result of if statement use in another if statement

To achieve this in Excel, you can use nested IF statements. The first IF statement will check the selected tool size, and based on the result, the second IF statement will use the data from the first statement to compare the value and display the desired result.

Let's assume the following:

• Cell A1 contains the selected tool size (e.g., "Size A" or "Size B").
• Cell B1 contains the following data for "Size A": "Small," "Medium," "Large," and for "Size B": "Extra Small," "Extra Large."

You can use the following nested IF statements in Excel:

In cell C1, enter the following formula to display the data based on the selected tool size:

=IF(A1="Size A", INDEX(B1:B4, ROW()), IF(A1="Size B", INDEX(B5:B6, ROW()), ""))

Explanation:

• The first IF statement checks if A1 is equal to "Size A." If it's true, the INDEX function retrieves the data for "Size A" from the range B1:B4 based on the current row number using ROW() function.
• If the first IF statement is false, the second IF statement checks if A1 is equal to "Size B." If it's true, the INDEX function retrieves the data for "Size B" from the range B5:B6 based on the current row number using ROW() function.
• If both IF statements are false, an empty string ("") is returned.

Now, in cell D1, you can use another IF statement to compare the result from cell C1 and display the desired result. For example:

=IF(C1="Small", "Tool is suitable for small tasks", IF(C1="Medium", "Tool is suitable for medium tasks", IF(C1="Large", "Tool is suitable for large tasks", IF(C1="Extra Small", "Tool is suitable for extra small tasks", IF(C1="Extra Large", "Tool is suitable for extra large tasks", "")))))

In this example, the nested IF statement checks the value in cell C1 and displays a message based on the size selected. You can adjust the messages and conditions as needed.

Make sure to adjust the ranges and conditions in the formulas based on your actual data and requirements. Since no one has replied to this for over a day and more, I entered your question in various AI's. The text and the steps are the result of the compilation of different AI's. The formulas are untested.

My answers are voluntary and without guarantee!