Thursday, October 22, 2020

Getting Jiggy with IF. Working with IF functions in Excel

 

What is the IF function

The IF function allows a user to make comparisons based on a defined logic, returning different results based on whether or not the expression is true or false. 

 

Why is the IF function important

The key to building dynamic spreadsheets is the IF function. The function is incredibly versatile and can be used for everything from aggregation to data manipulation.

 

 

How do you use an IF function

Lets start with the components of the function. An IF formula is written as:

=IF(Logical_Test,[Value if true],[Value if false])

 

There are three arguments in the IF function

1 Logical Test - This is the condition we're testing for. This consists of a value or expression that can be evaluatied as true or false (ex: 1 = 2, FALSE)

2 Value if true - This is the formula output if the  condition is true. By default TRUE is returned if this is left blank

3 Value if false - This is the formula output if the condition is false. By default False is returned if this is left blank

 

Quick examples

=IF(1=2,"Green","Red")

Result: Red

 

=IF(1<2,"Green","Red")

Result: Green

 

Pretty simple to follow, right? Lets dive into a more complex example

 

 Suppose you had to identify which cells were numbers in the following set of data.

 



The goal is to mark anything that’s non-numeric with a "Y" to indicate that the row should be ignored.

 

To express this as an IF formula in cell C2 we can use 

=IF(ISTEXT(A2),"Y","N")

 

If we were to click and drag to apply to all cells the results would be

 


 

Have a good understanding of the IF function? Ready to take your IF knowledge to the next level? IF so check out our Getting Jiggier with IF post to learn about how to use AND / OR with the IF function



No comments:

Post a Comment