J
jg70124
I'm trying to get the sum of a set of cells, where the set is
determined by the result of a calculation.
Here's what I want to do:
- If 0 <= a1 < 30, return 0
- If 30 <= a1 < 60, return sum(d2)
- If 60 <= a1 < 90, return sum(c2:d2)
- If 90 <= a1 < 120, return (b2:d2)
- If 120 <=a1 < 150, return (a2:d2)
Of course I can do this with a bunch of nested if statements, but I
wondered if there was a more elegant way to do it.
Thanks.
determined by the result of a calculation.
Here's what I want to do:
- If 0 <= a1 < 30, return 0
- If 30 <= a1 < 60, return sum(d2)
- If 60 <= a1 < 90, return sum(c2:d2)
- If 90 <= a1 < 120, return (b2:d2)
- If 120 <=a1 < 150, return (a2:d2)
Of course I can do this with a bunch of nested if statements, but I
wondered if there was a more elegant way to do it.
Thanks.