Convert formula to a worksheet function

sharky12345

Well-known Member
Joined
Aug 5, 2010
Messages
3,404
Office Version
  1. 2016
Platform
  1. Windows
I'm using this to populate a column but it takes ages to run as there are over 15000 rows - is it possible to turn this into a worksheetfunction and if yes I assume it will run a lot quicker?

VBA Code:
Range("S2").Formula = "=IFERROR(INDEX(DATA!F2:F" & LastDataRow & ",AGGREGATE(14,6,(ROW(DATA!D2:D" & LastDataRow & ")-ROW(DATA!D2)+1)/(DATA!C2:C" & LastDataRow & "=A2)/(DATA!D2:D" & LastDataRow & "<G2),1)),"""")"
Range("S2").AutoFill Destination:=Range("S2:S" & LastRow), Type:=xlFillDefault
Application.Calculation = xlCalculationAutomatic
Range("S2:S" & LastRow).Value = Range("S2:S" & LastRow).Value
 

Excel Facts

Formula for Yesterday
Name Manager, New Name. Yesterday =TODAY()-1. OK. Then, use =YESTERDAY in any cell. Tomorrow could be =TODAY()+1.
What does this formula do?
If you explain it in detail, then maybe a faster vba code can be an option.
 
Upvote 0
  1. In the active sheet, can the same value appear more than once in column A?

  2. Are you sure that there shouldn't be some $ signs in those formulas that you are inserting into the workbook? I would have thought that all the multi-row ranges would have their rows locked.

  3. 15,000 rows in which sheet? Or both? If not both then please specify approximate number of rows in each one
 
Upvote 0

Forum statistics

Threads
1,214,405
Messages
6,119,315
Members
448,886
Latest member
GBCTeacher

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