Having trouble with a simple nexted IF function

I have this formula in cell H2 which I thought would work but does not …

=IF(I2>J2,“more”,IF(I2=J2,“same”,IF(I2<J2,“less”,"")))

I’m trying to make the formula enter

more in H2 if I2 is greater than J2
same in H2 if I2 is the same as J2 or
less in H2 if I2 is lessthan J2.

Cell I2 contains the number 22. Cell J2 contains the number 11.

So to me, H2 should be filled with more.

But all I get is Err:501.

Also, Calc is automatically adding an extra parenthesis at then end. I have no idea why?

The formula I’ve entered is

=IF(I2>J2,“more”,IF(I2=J2,“same”,IF(I2<J2,“less”,"")))
as I said, but Calc is turning it into:
=IF(I2>J2,“more”,IF(I2=J2,“same”,IF(I2<J2,“less”,""))))

Please can someone help me. Thank you. :sunny:

depends on your Locale-setting, but semicolon instead comma should work in any Locale

=IF(I2>J2;"more";IF(I2=J2;"same";IF(I2<J2;"less";"")))

alternativly use simply

=I2-J2

with Numberformat-code

"more";"less";"same";""
3 Likes

Thank you, but it wasn’t the commas.

dscheikey was correct. I was using the wrong characters for the double quotes.

You used the wrong characters for the double quotes.

Please try:

=IF(I2>J2,"more",IF(I2=J2,"same",IF(I2<J2,"less","")))
Or something clearer with the IFS() function:

=IFS(I2>J2,"more",I2=J2,"same",I2<J2,"less","")
1 Like

Thank you so much for replying so quickly.

That was of course the answer.

:+1: