mardi 12 juin 2018

Excel IF AND OR multiple times

I've seen many questions on here relating to this topic but most seem to stop after 2 scenarios. I'm trying to write a formula to say something like this:

IF this value is between these two values, output A. If the same value is between these other two values, output B. If the same value is between yet a further two values, output C and if the same value is between a last two further values, output D.

Here's what I have so far: =IF(AND(Sheet1!C2>'Control Sheet'!B2,Sheet1!C2<'Control Sheet'!C2),"A",IF(OR(Sheet1!C2>'Control Sheet'!B3,Sheet1!C2<'Control Sheet'!C3),"B",IF(OR(Sheet1!C2>'Control Sheet'!B4,Sheet1!C2<'Control Sheet'!C4),"C",IF(OR(Sheet1!C2>'Control Sheet'!B5,Sheet1!C2<'Control Sheet'!C5),"D",""))))

But it only outputs "A" or "B" and stays on "B" if the value should be "C" or "D".. if that makes sense.

Is this possible in Excel? If so, what have I done wrong? Thanks :)

Aucun commentaire:

Enregistrer un commentaire