Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

Match vs Loop

Posted on 2014-03-15
3
Medium Priority
?
572 Views
Last Modified: 2014-03-16
I am curious of performance from doing a loop vs a Match function.  If I have a worksheet lets called parts with 10,000 rows and 15 columns.  I have another worksheet in the same workbook lets call regional daily orders.  If every day I review every row in the regional daily orders worksheet (daily row count of 500) for a column called part number and find the corresponding  part number in the worksheet called parts and store the value price and manufacture is this better accomplished with a loop or match function or something else.

I am pretty familiar with loops, but I do not want this to be a case where I am doing a loop for comforts sake...if there is a better method then I would like to learn..
0
Comment
Question by:upobDaPlaya
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
3 Comments
 
LVL 81

Accepted Solution

by:
zorvek (Kevin Jones) earned 1000 total points
ID: 39931699
Without more information, a MATCH function in a formula will most definitely be faster than a VBA loop doing the same. Excel's built in functions are optimized compiled code that have access to many more underlying data structures than we do using VBA. They are optimized for performance while VBA is a more generalized and interpreted automation language.

Kevin
0
 
LVL 39

Assisted Solution

by:nutsch
nutsch earned 1000 total points
ID: 39931704
As Kevin said much better than I can, I think the most straightforward way, and potentially the fastest, is to run a vlookup (or a match) in the worksheet, then paste the values, e.g.

sheets("Orders").range("E2:E6500").formular1c1="=vlookup(rC2,Parts!R1C1:R150000C15,3,0)"
sheets("Orders").range("E2:E6500").value=sheets("Orders").range("E2:E6500").value

Open in new window


then do the same for the manufacturer.

Thomas
0
 

Author Closing Comment

by:upobDaPlaya
ID: 39933418
I fooled around with a match function today...wish I knew of it earlier :)
0

Featured Post

How to Use the Help Bell

Need to boost the visibility of your question for solutions? Use the Experts Exchange Help Bell to confirm priority levels and contact subject-matter experts for question attention.  Check out this how-to article for more information.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

When you see single cell contains number and text, and you have to get any date out of it seems like cracking our heads.
Access developers frequently have requirements to interact with Excel (import from or output to) in their applications.  You might be able to accomplish this with the TransferSpreadsheet and OutputTo methods, but in this series of articles I will di…
The viewer will learn how to create a normally distributed random variable in Excel, use a normal distribution to simulate the return on an investment over a period of years, Create a Monte Carlo simulation using a normal random variable, and calcul…
Many functions in Excel can make decisions. The most simple of these is the IF function: it returns a value depending on whether a condition you describe is true or false. Once you get the hang of using the IF function, you will find it easier to us…

597 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question