Syntax: Applying IF to a cell range in Excel

558 views Asked by At

I've been trying to write a formula to summarise in one cell the presence/ absence of certain values in a different range of of cells in Excel

So in the one table and worksheet, I wrote

=IF(B1:F1=1,1,0) Formula 1

which is supposed to mean

If any of the values in cells B1:F1 are equal to 1, then note 1, otherwise not 0.

But somehow the syntax isn't working.

I've applied "" and ; and brackets right left and centre, but to no avail.

I'm pretty sure I done this before and it was pretty simple when I hit upon the right synstax, but the how and where fell through the colander which is my brain today :-?

Additionally I will want to ask the formula to apply another condition to the output cell which is =if (A1 = value n or certain values, 1, 0) Formula2 Column A has numerically coded ordinal values 0-9, so an aexample of teh 1 conditions might be any of values 1, 2 or 9 in column, should produce a 1 in the result cell in which Formula 1 and 2 will be written.

So the result cell would contain somelike =Formula1_or_Formula2_contain_certain_values, 1, 0) Formula 3 Obviously the systax of Formulas 2 and 3 is awol, but I write to demonostrate the formulae intended purposes.

1

There are 1 answers

3
Vityata On

The easiest way to make the first formula is like this:

=IF(SUM(B1:E1)>0,1,0)

No arrays, no problems :)