Short version of a formula?

F4TMAN

New Member
Joined
Jun 29, 2020
Messages
23
Office Version
  1. 365
  2. 2010
Platform
  1. Windows
Hello, I'm looking for the possibility of shortening the formula i currently have its really slowing down my excel and takes a long time to load.

Excel Formula:
=IF(AND(Expense!C2='P&L Month'!$I$5,COUNTIFS(Expense!$C$2:Expense!C2,Expense!C2,Expense!$D$2:Expense!D2,Expense!D2)=1),"YES","")

keeping in mind that I'm going to drag the formula down to row 5000. Since I'm referencing different tab sheets i was thinking about using name manager not sure if that would help. Any ideas? if you need more information please let me know.

Thank you.
 

Excel Facts

Workdays for a market open Mon, Wed, Friday?
Yes! Use "0101011" for the weekend argument in NETWORKDAYS.INTL or WORKDAY.INTL. The 7 digits start on Monday. 1 means it is a weekend.

jasonb75

Well-known Member
Joined
Dec 30, 2008
Messages
13,146
Office Version
  1. 365
Platform
  1. Windows
By using 2 IF's instead of AND you can bypass the slower COUNTIFS function when C2 is not a match for $I$5.
Excel Formula:
=IF(Expense!C2='P&L Month'!$I$5,IF(COUNTIFS(Expense!$C$2:Expense!C2,Expense!C2,Expense!$D$2:Expense!D2,Expense!D2)=1,"YES",""),"")
Other than that, you could try different functions in place of countifs to see if anything is quicker, but to be honest I don't think that using that formula dragged down 5000 rows should be causing too much of a problem.

I set up a test sheet with 5000 rows of random data and it takes 2 seconds to load with your original formula (which will include the time it takes for the test data to randomise).
 

Forum statistics

Threads
1,136,302
Messages
5,674,965
Members
419,537
Latest member
ucatchy

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?

Disable AdBlock

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
Top