Short version of a formula?

F4TMAN

New Member
Joined
Jun 29, 2020
Messages
25
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

Highlight Duplicates
Home, Conditional Formatting, Highlight Cells, Duplicate records, OK to add pink formatting to any duplicates in selected range.
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).
 
Upvote 0

Forum statistics

Threads
1,215,046
Messages
6,122,852
Members
449,096
Latest member
Erald

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
Back
Top