How to add to the value of one cell an amount that depends upon the range of a different cell?


A user of Web Applications asked how to:

  • +1 when the value is >=5,
  • +2 when the value is >=10,
  • +3 when the value is >=15,
  • +4 when the value is >=20,
  • +5 when the value is >=25

and had tried:


in Google Sheets without success. The formula does however indicate that the 'value' resides in F7 and supplementation is of the H7 value.

As explained by an answer that retains the original concept of nested IFs:


If the first condition is F7>=5 then the result will always be +1 wether F7 = 5, 15, or even 200. It's because the first condition F7>=5 is always met.

Stepping down the ranges does achieve the desired result but is there a shorter of more versatile solution, since nested IFs with ranges are often problematic?

Why should this post be closed?

1 comment

Stepping down through the ranges ... or reversing the comparison: if (f7<5;;if (f7<10; h7+1; if (f7<15; h7+2; ... ))) ‭mcalex‭ 16 days ago

1 answer


One way is to create a lookup table (sorted ascending) and take advantage of VLOOKUP's is_sorted parameter to opt for "the nearest match (less than or equal to the search key)".

Say a table like so:

0	0
5	1
10	2
15	3
20	4
25	5

with the Named Range Table. Then a formula such as:


to determine the supplement and add it to H7.

This approach could be versatile where changes to the ranges are required and more manageable than adapting a nested IF formula. The table is reasonably intuitive as quite similar to the requirement as expressed in the source question. It would be more so if the columns were switched over, but VOOKUP is simpler than an INDEX/MATCH pair and requires the search_key to be on the left of the range.

However, where the steps are uniform (of 5 each here) a separate table is not required:


applying CHOOSE, and a (slightly) shorter formula is possible:


This adds to H7 the rounded down to integer (INT) result of dividing F7 by the range 'width' (each step is 5), capped at 5 (MIN).

The above applies to Excel as well.


Sign up to answer this question »