Faster than a look up formula?

Blunder1

Active Member
Joined
Jun 2, 2010
Messages
250
Hi,

I have two sheets in a workbook containing over 20,000 rows in each. On both sheets in Column A they share a common reference on a majortiy on the rows. Sheets 1 Column A contains the ref, Column M and N contain numbers. Sheet 2 column A contains the ref and column L and M contain the numbers. In my code i have a formula as per the below so i can sum the difference of the two number columns for each matching ref.

Sheet2
=L2-vlookup(a2,Sheets1!A:N,13,0)
=M2-vlookup(a2,Sheets1!A:N,14,0)

This take ages to run though so was hoping someone may have a faster but if code i can use

Thanks in advance

Blunder
 

Excel Facts

How to find 2nd largest value in a column?
MAX finds the largest value. =LARGE(A:A,2) will find the second largest. =SMALL(A:A,3) will find the third smallest
Instead of VLOOKUP, try:
Code:
=L2-INDEX(Sheets1!A:N,MATCH(A2,Sheets1!A:A,0),13)
=M2-INDEX(Sheets1!A:N,MATCH(A2,Sheets1!A:A,0),14)
 
Upvote 0
Lookup-style formulas are inheritantly slow, but given that your data being returned is numerical, we might have a way around this.

In column A of your Sheet1, are each of the values there unique (not repeated)?
 
Upvote 0
Try these formulas out:

=L2-SUMIF(Sheets1!A:A,A2,Sheets1!M:M)
=M2-SUMIF(Sheets1!A:A,A2,Sheets1!N:N)
 
Upvote 0

Forum statistics

Threads
1,224,587
Messages
6,179,738
Members
452,940
Latest member
Lawrenceiow

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