Logical functions

IFS

Matches all 1,254 recorded answers

Recorded: 1,212 in the answer bank and 42 workbook cells. How we measure this · See the Rust code

Local names in 40 languages
LanguageName in Excel
ArabicIFS
BulgarianIFS
CzechIFS
DanishHVISER
GermanIFS
GreekIFS
English (Australia)IFS
English (United Kingdom)IFS
English (United States)IFS
SpanishSI.CONJUNTO
EstonianIFS
FinnishJOS.JOUKKO
FrenchSI.CONDITIONS
HebrewIFS
CroatianIFS
HungarianHAELSŐIGAZ
IndonesianIFS
ItalianIFS
JapaneseIFS
KoreanIFS
LithuanianIFS
LatvianIFS
NorwegianIFS
DutchALS.VOORWAARDEN
PolishIFS
Portuguese (Brazil)IFS
Portuguese (Portugal)SE.S
RomanianIFS
RussianЕСЛИМН
SlovakIFS
SlovenianIFS
Serbian (Latin)IFS
SwedishIFS
ThaiIFS
TurkishIFS
UkrainianIFS
VietnameseIFS
Chinese (Simplified)IFS
Chinese (Hong Kong)IFS
Chinese (Traditional)IFS

Names from Microsoft's support site.

What it does

IFS(test1, value1, [test2, value2], …)

IFS(test1, value1, [test2, value2], …) chooses the value paired with the first true test. Order matters: put more specific or higher-priority conditions first. Microsoft documents up to 127 condition/value pairs.

There is no separate default argument. A final TRUE, fallback pair supplies a default; without any true test, the result is #N/A.

For example, =IFS(85>=90,"A",85>=80,"B",TRUE,"C") selects "B".

Try it

Input cells (optional)

Example: {"B2": 3, "B3": 4}. A1 holds the formula. Other cells need values before a formula can read them.

Enter a formula, then calculate.

Runs locally in your browser with OneCalc. Its answer may differ from Excel. Use English function names and commas between arguments.

Start with the example's first true condition, then make it false to reach the fallback. Remove the final TRUE pair to see the unmatched case. Keep the condition/value pairs balanced.

Quirks

Microsoft documents #VALUE! if an evaluated condition cannot resolve to TRUE or FALSE, and an entry-time error message if a condition has no paired value. Those are distinct from an unmatched but otherwise valid call returning #N/A.

The selected value can retain its reference identity. On the recorded build, ISBLANK(IFS(TRUE,Data!Z1)) returns TRUE when that cell is empty. Converting every selected reference to a number would lose this behaviour.

Later arrays do not necessarily enlarge the result. The recorded IFS(TRUE,1,{FALSE,TRUE},{2,3}) returns one 1. This observation is about the selected result and shape; it does not establish that every unselected expression avoids evaluation. Do not infer a general short-circuit guarantee from the phrase “first true condition”.

IFS and SWITCH pass on the selected value whole, and later arrays do not lift the call

Once a scalar test selects a result, array arguments after it have no effect on the shape: IFS(TRUE,1,{FALSE,TRUE},{2,3}) and SWITCH(2,2,1,{1,2},3) each return one 1, not an array, and SWITCH("A","a",1,{"A","A"},2) returns 1 because the match ignores case. The selected value itself is passed on as it is. A selected reference stays a reference: ISBLANK(IFS(TRUE,Data!Z1)) is TRUE over an empty cell. A selected LAMBDA shows as #CALC! in the cell, IFS(TRUE,LAMBDA(xx,xx)), and a selected array of LAMBDAs as #CALC! in each cell. A test that is not TRUE or FALSE gives #VALUE! in the shape of its result: IFS("2",{"hit","hit"}) is {#VALUE!,#VALUE!}. A direct error as the SWITCH expression stays one error: SWITCH(#VALUE!,1,{1,2},0) is #VALUE!.

FormulaExcelMathematical value
=IFS(TRUE,1,{FALSE,TRUE},{2,3})
Excel 16.0.20527.20088 Current Channel, Windows 64-bit (NT 10.0.26200), x86-64, AMD Ryzen 7 4800H, en-ZA
Inputs and reference value

Typed formula.

1
0x3ff0000000000000
—
=SWITCH(2,2,1,{1,2},3)
Excel 16.0.20527.20088 Current Channel, Windows 64-bit (NT 10.0.26200), x86-64, AMD Ryzen 7 4800H, en-ZA
Inputs and reference value

Typed formula.

1
0x3ff0000000000000
—
=SWITCH("A","a",1,{"A","A"},2)
Excel 16.0.20527.20088 Current Channel, Windows 64-bit (NT 10.0.26200), x86-64, AMD Ryzen 7 4800H, en-ZA
Inputs and reference value

Typed formula.

1
0x3ff0000000000000
—
=ISBLANK(IFS(TRUE,Data!Z1))
Excel 16.0.20527.20088 Current Channel, Windows 64-bit (NT 10.0.26200), x86-64, AMD Ryzen 7 4800H, en-ZA
Inputs and reference value

Number supplied through a cell.

Data!Z1: (empty cell)

TRUE—
=ISBLANK(SWITCH(1,1,Data!Z1))
Excel 16.0.20527.20088 Current Channel, Windows 64-bit (NT 10.0.26200), x86-64, AMD Ryzen 7 4800H, en-ZA
Inputs and reference value

Number supplied through a cell.

Data!Z1: (empty cell)

TRUE—
=IFS(TRUE,LAMBDA(xx,xx))
Excel 16.0.20527.20088 Current Channel, Windows 64-bit (NT 10.0.26200), x86-64, AMD Ryzen 7 4800H, en-ZA
Inputs and reference value

Typed formula.

#CALC!—
=SWITCH(1,1,LAMBDA(xx,xx))
Excel 16.0.20527.20088 Current Channel, Windows 64-bit (NT 10.0.26200), x86-64, AMD Ryzen 7 4800H, en-ZA
Inputs and reference value

Typed formula.

#CALC!—
=IFS(TRUE,HSTACK(LAMBDA(xx,xx),LAMBDA(xx,xx)))
Excel 16.0.20527.20088 Current Channel, Windows 64-bit (NT 10.0.26200), x86-64, AMD Ryzen 7 4800H, en-ZA
Inputs and reference value

Typed formula.

{#CALC!,#CALC!}—
=IFS("2",{"hit","hit"})
Excel 16.0.20527.20088 Current Channel, Windows 64-bit (NT 10.0.26200), x86-64, AMD Ryzen 7 4800H, en-ZA
Inputs and reference value

Typed formula.

{#VALUE!,#VALUE!}—
=SWITCH(#VALUE!,1,{1,2},0)
Excel 16.0.20527.20088 Current Channel, Windows 64-bit (NT 10.0.26200), x86-64, AMD Ryzen 7 4800H, en-ZA
Inputs and reference value

Typed formula.

#VALUE!—

Inputs, build details and evidence

How to implement

Represent the condition/value pairs explicitly and reject unpaired syntax at the formula boundary. Determine the first matching condition according to Excel's logical coercion and error rules, then return its corresponding value with its reference or callable identity intact.

Treat argument evaluation policy and result selection as separate design choices. Test an unselected error, volatile function, recursive lambda and array independently before replacing IFS with a chain of lazy IF operations. Selecting the same visible value does not prove the same evaluation behaviour.

For array inputs, measure which conditions establish the output shape and when selection stops that process. Apply errors per output coordinate where the measured rule calls for it. A blanket broadcast over every argument contradicts the scalar-selection example above.

Rust code

Show the CalcFunc source of this function

Quoted from the public repository DnaCalc/DnaCalc, crates calc-func and calc-fml, at commit 9e1884369a67. Comments are the source's own. A kernel shared with other functions appears once, on its module page.

IFS · 12 lines · calc-func/src/catalogue/logical_more.rs on GitHub
CatalogueEntry {
    id: IFS,
    spelling: "IFS",
    notation: Notation::Call,
    arity: CallableArityShape::range(2, 254),
    parameters: &[
        Parameter::value("logical_test1"),
        Parameter::value("value_if_true1"),
    ],
    demand: ArgumentDemand::Eager,
    kernel: Kernel::Eager(ifs),
}
ifs · 14 lines · calc-func/src/catalogue/logical_more.rs on GitHub
fn ifs(
    arguments: &[CalcValue],
    services: &mut EvalServices<'_>,
) -> Result<CalcValue, FunctionFault> {
    selection(IFS, arguments, services, |s, a| {
        if !a.len().is_multiple_of(2) {
            return fail(WorksheetErrorCode::Value);
        }
        match ifs_index(s, a)? {
            Some(index) => Ok(selected(&a[index])),
            None => fail(WorksheetErrorCode::NA),
        }
    })
}
ifs_index · 10 lines · calc-func/src/catalogue/logical_more.rs on GitHub
/// The first true IFS condition. Shape admission and selection share logical coercion;
/// the kernel validates pair structure before using the selected result index.
fn ifs_index(site: &Site<'_>, arguments: &[CalcValue]) -> Step<Option<usize>> {
    for pair in (0..arguments.len()).step_by(2) {
        if flag(site, arguments, pair)? {
            return Ok(Some(pair + 1));
        }
    }
    Ok(None)
}

Kernels shared with other functions

Argument and result plumbing

No implementation has been published with a Handbook test suite for this function.

Version differences

The recorded environments below distinguish a reading from a same-input comparison. Counts describe captured inputs in each environment; overlapping captures and comparisons are not totals of unique worksheet calls.

Excel 16.0 buildPlatform and CPUCaptured inputs
20430Windows, 64-bit, CPU not recorded1,212

The record contains no same-input comparison between these environments. Reading different inputs on different builds does not establish either a version change or cross-build agreement.

Recorded environments and comparison details.

Excel 16.0.20527.20088

Windows 64-bit (NT 10.0.26200), x86-64, AMD Ryzen 7 4800H, en-ZA

=IFS(TRUE,1,{FALSE,TRUE},{2,3}) returned 1 (0x3ff0000000000000). =ISBLANK(IFS(TRUE,Data!Z1)) returned TRUE. 3 further recorded controls are attached. Inputs were supplied through cells using Value2, formula literals. These are controls from this environment, not a same-input comparison with another build.

Observed formulas and results
  • =IFS(TRUE,1,{FALSE,TRUE},{2,3}) → 1
    0x3ff0000000000000 (formula-literal)
  • =ISBLANK(IFS(TRUE,Data!Z1)) → TRUE (cell-value2)
  • =IFS(TRUE,LAMBDA(xx,xx)) → #CALC! (formula-literal)
  • =IFS(TRUE,HSTACK(LAMBDA(xx,xx),LAMBDA(xx,xx))) → {#CALC!,#CALC!} (formula-literal)
  • =IFS("2",{"hit","hit"}) → {#VALUE!,#VALUE!} (formula-literal)

Excel 16.0 build 20430

Windows, 64-bit, CPU not recorded

1,212 captured inputs are indexed for this environment. Capture dates: 2026-09-29 to 2026-09-29. This is a reading count, not a comparison with another build.

Alternatives

Use nested IF when its branch evaluation behaviour is required. Use SWITCH when comparing one expression with several candidate values. Use a lookup table when the conditions encode a growing data table. SUMIFS and COUNTIFS aggregate matching cells; they do not select a single branch.

Named variants

No named variants are recorded yet.

Suggest a correction or contribute an implementation · For agents