Forum Discussion

DeanDean7920's avatar
DeanDean7920
Copper Contributor
Jun 14, 2022

EXCEL IF statement

What is wrong with my statement, "Configurator!C42" has a value of 64 but result is 0, not 1? 

=IF(Configurator!C42>96<115,1,IF(Configurator!C42>48<68,1,IF(Configurator!C42<=8,1,0)))

2 Replies

  • JoeUser2004's avatar
    JoeUser2004
    Bronze Contributor

    DeanDean7920 

     

    The expression C42>96<115 does not work as you probably intended.  And frankly, it is nonsensical.

     

    I suspect you mean 96<C42<115; that is, the value of C42 is between 96 and 115.

     

    But even that does not work in Excel.  Instead, we must write AND(96<C42, C42<115).

     

    For your formula, we might write:

     

    =IF(AND(96<Configurator!C42, Configurator!C42<115), 1,

      IF(AND(48<Configurator!C42, Configurator!C42<68), 1,

      IF(Configurator!C42<=8, 1, 0)))

     

    or

     

    =IF(OR(AND(96<Configurator!C42, Configurator!C42<115),

      AND(48<Configurator!C42, Configurator!C42<68), Configurator!C42<=8), 1, 0)

     

Resources