I am using this formula:
=IF(MASTER!B68:AL68="Rezdy",SUM(MASTER!B77:AL77),0)
It returns 400.
But if I paste it exactly the same in another cell, I get the return 0.
I am using this formula:
=IF(MASTER!B68:AL68="Rezdy",SUM(MASTER!B77:AL77),0)
It returns 400.
But if I paste it exactly the same in another cell, I get the return 0.
When you copy a formula cell and paste into another cell, range references in the formula get adjusted relative to the locations of the two formula cells. To make range references in the formula remain the same, use absolute references with $
prefixes. See absolute and relative references.
The range references in your formula are not pointing to cells but to arrays of cells. When such references are used in scalar functions such as eq()
or =
, exactly one cell is picked from the array based on the relative location of the formula cell. To avoid that, refer to a single cell, and use absolute addressing when you do not want the cell reference get adjusted based on formula location.
Aggregating functions such as sum()
always refer to the whole array. Whether relative or absolute addressing should be used depends on the semantics of what you are trying to do.
Try something like this to get started:
=if(MASTER!B68 = "Rezdy", sum(MASTER!$B$77:$AL$77), iferror(1/0) )
The IF function is comparing an array (MASTER!B68:AL68) to a value ("Rezdy"). This makes that the IF function returns multiple values, but by default it only will show a single value based on the position of the formula.
Depending of what you are looking for, you might have to modify MASTER!B68:AL68="Rezdy"
, use the ArrayFormula function to get all the values returned by the IF function, or to modify the whole formula.