I have the following formula which I will explain below:

```
{=SUM(IF(($G$1:$L$1=$O$1)*($G$2:$L$2=$O$2)*($G$3:$L$3=$O$3)*($G$4:$L$4=$O$4)*($G$5:$L$5=$O$5)*($G$6:$L$6=$O$6)*($G$7:$L$7=$O$7);G21:L21))}

```

Here is what the worksheet looks like:

[![enter image description here](https://i.stack.imgur.com/HdI89.png)](https://i.stack.imgur.com/HdI89.png)

Under columns **G - L** we have a 'database' of all data. These columns will be added cumulatively each quarter (approx 30 columns a quarter). So after a few years we have ended up with a bunch of database columns (1000 + columns of raw data). For the sake of this demo, I have only included those 6 columns. 

As you can see, each column contains specific parameters, between rows **1 - 7**, which allows to identify specific CountryCode + Project Code + Category + Fiscal Year, + ... (etc.). This allows us to track down a unique specific project and retrieve its data.

What we have afterwards on the column **O** is a specific project we are trying to retrieve values for (you can see that the rows **1 - 7** are the same as under column **G** (we are trying to retrieve values for this particular project).

[![enter image description here](https://i.stack.imgur.com/8FQQR.png)](https://i.stack.imgur.com/8FQQR.png)

Here comes our formula. I have attached above. Here is what it looks like when I press **F2**. As you can see the **IF** statement is first simply checking whether the particular columns match the pre-defined criteria under column **O** and it sums all the columns that match all the criteria between rows **1-7**.

Now here is the problem. We have a worksheet, which contains 20 projects (such as column O) and we are using this array formula there to retrieve values. The problem is that retrieving data using this way takes A LOT OF TIME. We have also adopted a principle via VBA that we iterate through all the cells, then we insert a formula, calculate array cell, and then we copy & Paste resulting value inside (so that we won't end up with full sheet of array formulas). However it still takes LONG to calculate (1 minute or so).

I was wondering, if there is a better solution how to retrieve the data in the already mentioned format (that means we have a specific criteria we are trying to find)? Maybe SUMIFS could be better? Or sumproduct? Or even compeltely different solution? 

I am open to any proposal which would fasten the process.