Simplify Numbers multiple if formula

I have made this formula to validade different conditions


IF(AND(SUM(N53:R53)=2;SUM(T53:U53)=0);"2";)+IF(AND(SUM(N53:R53)=1;SUM(T53:U53)=2);"12";)+IF(AND(SUM(N53:R53)=2;SUM(T53:U53)=1);"21";)+IF(AND(SUM(N53:R53)=2;SUM(T53:U53)=2);"22";)+IF(AND(SUM(N53:R53)=3;SUM(T53:U53)=0);"3";)+IF(AND(SUM(N53:R53)=3;SUM(T53:U53)=1);"31";)+IF(AND(SUM(N53:R53)=3;SUM(T53:U53)=2);"32";)+IF(AND(SUM(N53:R53)=4;SUM(T53:U53)=0);"4";)+IF(AND(SUM(N53:R53)=4;SUM(T53:U53)=1);"41";)+IF(AND(SUM(N53:R53)=4;SUM(T53:U53)=2);"42";)+IF(AND(SUM(N53:R53)=5;SUM(T53:U53)=0);"5";)+IF(AND(SUM(N53:R53)=5;SUM(T53:U53)=1);"51";)+IF(AND(SUM(N53:R53)=5;SUM(T53:U53)=2);"52";)



It basically looks here to validade those conditions

Is there a way to write it in less amount of code using another function?

Posted on Sep 8, 2022 6:39 AM

Reply
Question marked as Top-ranking reply

Posted on Sep 8, 2022 7:24 AM

Your results "31", "32" etc should not be in quotes but that is a side point to the answer to your question. It makes them strings. As numeric characters, Numbers turns them into numbers for the additions you are making but, in general, using + on a string is an error.


I can give a close answer but probably not a full answer. Not trying to muddy the waters but the problem is not fully defined.

  • I assume you want the answer to be a number, not a string of numeric digits. There is a difference.
  • I don't know if you really mean SUM or if you want COUNT or COUNTIF. I used SUM but if you put a number larger than 1 in any of those cells it will sum that number. COUNT will count how many cells have anything numeric in them. COUNTIF can count the number cells that have a 1, ignoring anything else. Or you could use checkboxes and then COUNTIF can count the number of checked boxes (cell = true).
  • I don't know what to do if SUM(N53:R53) is 0. The result will be 0 in the formula below.
  • In the formula below, if SUM(N53:R53)=4 and SUM(T53:U53)=0 the answer will be 4 (as in your screenshot) but it will also be 4 if SUM(N53:R53)=0 and SUM(T53:U53)=4


Anyway, maybe this formula will get you on a different track to solving your problem:

=IF(SUM(T53:U53)>0; SUM(T53:U53)+10×SUM(N53:R53);SUM(N53:R53))


You should also look at the IFS function if you need addition conditions in this formula, like for when SUM(N53:R53)=0.


(Edited to change commas to semicolons in the formula)


19 replies
Question marked as Top-ranking reply

Sep 8, 2022 7:24 AM in response to Jp-design

Your results "31", "32" etc should not be in quotes but that is a side point to the answer to your question. It makes them strings. As numeric characters, Numbers turns them into numbers for the additions you are making but, in general, using + on a string is an error.


I can give a close answer but probably not a full answer. Not trying to muddy the waters but the problem is not fully defined.

  • I assume you want the answer to be a number, not a string of numeric digits. There is a difference.
  • I don't know if you really mean SUM or if you want COUNT or COUNTIF. I used SUM but if you put a number larger than 1 in any of those cells it will sum that number. COUNT will count how many cells have anything numeric in them. COUNTIF can count the number cells that have a 1, ignoring anything else. Or you could use checkboxes and then COUNTIF can count the number of checked boxes (cell = true).
  • I don't know what to do if SUM(N53:R53) is 0. The result will be 0 in the formula below.
  • In the formula below, if SUM(N53:R53)=4 and SUM(T53:U53)=0 the answer will be 4 (as in your screenshot) but it will also be 4 if SUM(N53:R53)=0 and SUM(T53:U53)=4


Anyway, maybe this formula will get you on a different track to solving your problem:

=IF(SUM(T53:U53)>0; SUM(T53:U53)+10×SUM(N53:R53);SUM(N53:R53))


You should also look at the IFS function if you need addition conditions in this formula, like for when SUM(N53:R53)=0.


(Edited to change commas to semicolons in the formula)


Sep 8, 2022 8:34 PM in response to Jp-design

Jp-design wrote:

Hi SG

I was just cheking everithing and I have to make a correction

22 is a valid value too!


From your latest screenshot it seems as if you want a column that contains a code if the value is valid, and 0 if it is not.


If so, you can try something like this:




=IF(VALUE(V2&W2)<12;"0";IF(V2=0;"";V2)&IF(W2>0;W2;""))


If you don't like having the extra columns then in the formula you can simply substitute SUM(N2:R2) where you see V2 and SUM(T2:U2) where you see W2.


SG

Sep 8, 2022 7:14 AM in response to Jp-design

Both your screenshot and your formula appear to be truncated, making it very hard to follow what you are trying to do. Could you repost? It would be helpful to include the column letters at the top and row numbers at the left in your screenshot.


Also what are you trying to "validate" and what calculations are you doing to validate? All we can see is a partial formula and two (possibly three) cells with a green background somewhere in some Numbers table.


SG

This thread has been closed by the system or the community team. You may vote for any posts you find helpful, or search the Community for additional answers.

Simplify Numbers multiple if formula

Welcome to Apple Support Community
A forum where Apple customers help each other with their products. Get started with your Apple Account.