# Optimize Formula

#### Leticia

##### New Member
Hi!
How can I optimize the following formula - putting it in just one Countifs?

COUNTIFS('D'!\$P:\$P;"OTRO";'D'!\$G:\$G;"<="&\$F\$4)+COUNTIFS('D'!\$G:\$G;"<="&\$F\$4;'D'!\$Q:\$Q;">"&\$F\$4)

Thank you!

#### Leticia

##### New Member
Ok, I thought that you were trying to merge all 3 formulae into one, so that it would spill 5 rows & 6 columns, rather than trying to change the formulae.
Those 3 formula are doing completely different things. If they are not what you want, then you will need to rethink your approach.
Yeah I know, they are calculating what I want it is just that when Scenario 1 occurs I need the results from 1+ the results from 2
And in Scenario 2 i need the results from 1+ the results from 2.

My problem is that I dont know how to obtain the top 5 dynamic array with the sum of 1+2 in one case, and another different dynamic array (in another table) with the sum of 1+3

### Excel Facts

Can Excel fill bagel flavors?
You can teach Excel a new custom list. Type the list in cells, File, Options, Advanced, Edit Custom Lists, Import, OK

#### Fluff

##### MrExcel MVP, Moderator
As this has become a totally different question from your op & I have no idea what you are trying to do. I suggest that you start a new thread with some sample data & explain in words (not formulae) what you are trying to do.

#### Leticia

##### New Member
As this has become a totally different question from your op & I have no idea what you are trying to do. I suggest that you start a new thread with some sample data & explain in words (not formulae) what you are trying to do.
Great! Done in Dynamic Arrays - Top 5 values

Thanks.

Replies
3
Views
75
Replies
9
Views
202
Replies
6
Views
119
Replies
11
Views
141
Replies
4
Views
178

1,136,731
Messages
5,677,420
Members
419,692
Latest member
Also_Confused

### We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

### Which adblocker are you using?

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

### Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

### Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

### Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back