vendredi 15 novembre 2019

IF for a cell range in Google Sheets

In order to avoid the error #DIV/0!, I have a formula that tests a range of cells to see if all values are 0, then returns a message if so. Otherwise it performs an operation. My formula works but I was wondering if there is a way to reference the range of cells (that is luckily small) instead of testing each cell.

My formula is this:

=IF(C13+C14+C15+C16+C17+C18 =0,"Sin Registros",(((C13*$A$13)+(C14*$A$14)+(C15*$A$15+C16*$A$16)+(C17*$A$17)+(C18*$A$18))/C19))

And Im wondering if there's some way to instead write it to something like:

=IF(C13:C18=0,"Sin Registros",(((C13*$A$13)+(C14*$A$14)+(C15*$A$15+C16*$A$16)+(C17*$A$17)+(C18*$A$18))/C19))

Another example would be to change this one that tests for text but rather than a range is separate cells in an AND that tries each cell value:

=IF(AND(C38="Sin Registros",C29="Sin Registros",C20="Sin Registros"),"Sin Registros",AVERAGE(C38,C29,C20))

Towards something like:

=IF(C38,C29,C30="Sin Registros","Sin Registros",AVERAGE(C38,C29,C20)

I've checked some answers on the site but it seems that they make the formula even larger. The best example of that is this: google sheet IF AND for a range of rows

So in sum, the question is: Is there a way to reference a cell range directly for an if in Google Sheets?

Aucun commentaire:

Enregistrer un commentaire