Excel - Calculating formula taking too long. Is there an alternative to the below formula.

mrsushi

Board Regular
Joined
Nov 18, 2006
Messages
180
Office Version
  1. 2010
I have the below formula which references another sheet and returns the total summary value on sheet lp99. However, the sheet(Paste LP99) has over 200,000 lines of data and the calculation takes near enough 45min - 1 hour to calculate. Is there a alternative which can be used in order to speed up the calculation? Ive heard arrays could work but not used these before?


SUMIF('PASTE LP99'!A:A, A43, 'PASTE LP99'!L:L)
SUMIF('PASTE LP99'!A:A, A43, 'PASTE LP99'!V:V)


Any help would be much appreciated

Many thanks
M
 
Glad to help & thanks for the feedback.
 
Upvote 0

Excel Facts

Is there a shortcut key for strikethrough?
Ctrl+S is used for Save. Ctrl+5 is used for Strikethrough. Why Ctrl+5? When you use hashmarks to count |||| is 4, strike through to mean 5.
I've rerun the macro and just uncovered that the macro did populate results. However, a number of cells havent pulled any figures in. The below is the macro used


VBA Code:
Sub mrsushi1()

   Dim Ary As Variant, Oary As Variant

   Dim Dic As Object

   Dim r As Long



   Set Dic = CreateObject("Scripting.dictionary")

   With Sheets("PASTE LP99")

      Ary = .Range("A2:L" & .Range("A" & Rows.Count).End(xlUp).Row).Value2

   End With

   For r = 1 To UBound(Ary)

      Dic(Ary(r, 1)) = Dic(Ary(r, 1)) + Ary(r, 12)

   Next r

   With Sheets("Available Prices")

      Ary = .Range("A2", .Range("A" & Rows.Count).End(xlUp)).Value2

      Oary = .Range("AA2:AA" & .Range("A" & Rows.Count).End(xlUp).Row).Value2

   End With

   For r = 1 To UBound(Ary)

      Oary(r, 1) = Dic(Ary(r, 1))

   Next r

   Sheets("Available Prices").Range("AA2").Resize(UBound(Oary)).Value = Oary

End Sub
Hi Fluff, Just going back to this formula. I've noticed that some random figures are being returned as the data appears not to be on the other sheet. How would the formula be amended to say - if value isnt on other sheet, then return with nothing?

Many thanks
Martin
 
Upvote 0
It's actually a macro & not a formula. ;)
How would the formula be amended to say - if value isnt on other sheet, then return with nothing?
That's what it did originally, but you wanted that changed.
 
Upvote 0

Forum statistics

Threads
1,214,649
Messages
6,120,728
Members
448,987
Latest member
marion_davis

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