IFS function

The IFS function checks whether one or more conditions are met and returns a value that corresponds to the first TRUE condition. IFS can take the place of multiple nested IF statements, and is much easier to read with multiple conditions.

Note: This function is available if you are an Office 365 subscriber and have the latest version of Office installed. It's also available with Excel Online, Excel Mobile, and Excel for Android phones and tablets.

Simple syntax

  • IFS([Something is True1, Value if True1, [Something is True2, Value if True2],…[Something is True127, Value if True127])

Notes: The IFS function allows you to test up to 127 different conditions.

For example:

  • =IFS(A1=1,1,A1=2,2,A1=3,3)

Which says IF(A1 equals 1, then display 1, IF A1 equals 2, then display 2, or else if A1 equals 3, then display 3).

It's generally not advisable to use too many conditions with IF or IFS statements, as multiple conditions need to be entered in the correct order, and can be very difficult to build, test and update.

Syntax

  • IFS(logical_test1, value_if_true1, [logical_test2, value_if_true2], [logical_test3, value_if_true3],…)

Argument

Description

logical_test1 (required)

Condition that evaluates to TRUE or FALSE.

value_if_true1 (required)

Result to be returned if logical_test1 evaluates to TRUE. Can be empty.

logical_test2…logical_test127 (optional)

Condition that evaluates to TRUE or FALSE.

value_if_true2…value_if_true127 (optional)

Result to be returned if logical_testN evaluates to TRUE. Each value_if_trueN corresponds with a condition logical_testN. Can be empty.

Example 1

IFS function Grades example.  Formula in cell B2 is 	=IFS(A2>89,"A",A2>79,"B",A2>69,"C",A2>59,"D",TRUE,"F")

The formula for cells A2:A6 is:

  •  =IFS(A2>89,"A",A2>79,"B",A2>69,"C",A2>59,"D",TRUE,"F")

Which says IF(A2 is Greater Than 89, then return a "A", IF A2 is Greater Than 79, then return a "B", and so on and for all other values less than 59, return an "F").

Example 2

IFS function - Days of the Week example - Formula in cell G2 is 	=IFS(F2=1,D2,F2=2,D3,F2=3,D4,F2=4,D5,F2=5,D6,F2=6,D7,F2=7,D8)

The formula in cell G7 is:

  •  =IFS(F2=1,D2,F2=2,D3,F2=3,D4,F2=4,D5,F2=5,D6,F2=6,D7,F2=7,D8)

Which says IF(the value in cell F2 equals 1, then return the value in cell D2, IF the value in cell F2 equals 2, then return the value in cell D3, and so on, finally ending with the value in cell D8 if none of the other conditions are met).

Remarks

  • To specify a default result, enter a condition that will always be true for your final logical_test argument, such as TRUE or 1=1. If none of the other conditions are met the corresponding value will be returned. In Example 1, rows 6 and 7 (with the 58 grade) demonstrate this.

  •  If a logical_test argument is supplied without a corresponding value_if_true, this function shows a "You've entered too few arguments for this function" error message.

  •  If a logical_test argument is evaluated and resolves to a value other than TRUE or FALSE, this function returns a #VALUE! error.

  •  If no TRUE conditions are found, this function returns #N/A error.

Did you know?

If you don’t have an Office 365 subscription or Excel 2016 or later, you can try them for free!

Try Office 365 or the latest version of Excel

Do you have a specific function question?

Post a question in the Excel community forum

Help us improve Excel

Do you have suggestions about how we can improve the next version of Excel? If so, please check out the topics at Excel User Voice.

See Also

IF function

Advanced IF functions - Working with nested formulas and avoiding pitfalls

Training videos: Advanced IF functions

The COUNTIF function will count values based on a single criteria

The COUNTIFS function will count values based on multiple criteria

The SUMIF function will sum values based on a single criteria

The SUMIFS function will sum values based on multiple criteria

AND function

OR function

VLOOKUP function

Overview of formulas in Excel

How to avoid broken formulas

Use error checking to detect errors in formulas

Logical functions

Excel functions (alphabetical)

Excel functions (by category)

Share Facebook Facebook Twitter Twitter Email Email

Was this information helpful?

Great! Any other feedback?

How can we improve it?

Thank you for your feedback!

×