Not sure how to title this.

I have a capital expenditure (CapEx) table (Start and End = years, freq = every n years) like this:

```
Row/Col A B C D
1 Amount Start Freq Ends
2 1200 2022 2 2045
3 35000 2024 5 2050
4 15000 2023 3 2045
5 20000 2025 8 2056
```

Another table has columns for Year and Total_CapEx for that year.

```
Row/Col G H
11 Year Total_CapEx
12 2022 <formula>
13 2023 <formula>
14 2024 <formula>
and so on
```

The formula to determine the CapEx for a single item, for a single year, say H12 and row 2, is

```
=IF(G12>=D2,0,IF(MOD(G12-B2,C2)=0,1,0)*A2)
```

What is wanted, is a sum for all applicable CapEx for each year in column G. The long way would be to repeat the above formula for each row in the CapEx table in a SUM function. Not a good solution!

So two things are required:

- A shorthand formula, possibly using ranges, to get the sums.
- To be able to expand the CapEx table without having to change the formulas.

Is this possible ?