We help IT Professionals succeed at work.
Get Started

Looping until empty

Stephen Byrom
Last Modified: 2012-05-12
HI Experts,
I have a problem I need help with.
I have studied the "Match" and "Vlookup" in excel but they seem to just "get" the cell information, and I want to "put" the information based on match or lookup, probably looping, I'm not sure which.

The Workbook has two sheets, Sheet1, Sheet2.
Sheet1 has static data;
Column A week numbers, Column B dates, column C text;
Row 1 has code numbers from D1 through AX1

Sheet 2 has data pasted to it each week, always starting from A2 (row 1 has headings) and when the data has been dealt with it is then cleared.
Column A has code numbers
Cell B2 has the date
Column C are numbers
Cell D2 has a number

This is probably a big ask, but I would like to automate the process of dealing with the data in sheet 2.

1. Look at the date in Sheet2 B2, and find the matching date down column B of Sheet1. The row number of this matched cell is now the entry row for the remaining data.
2. Copy Sheet2 D2 value, to column C in the entry row of Sheet1.
3. Look along row 1 in sheet1 until a cell matches A2 in Sheet2, then copy Sheet2 C2 value to the entry row in this matched column in Sheet1.
4. Delete row 2 in Sheet2.

Repeat steps 3 and 4 until no data is in A2 Sheet2.

As always, your time is much appreciated.

Watch Question
This problem has been solved!
Unlock 1 Answer and 10 Comments.
See Answer
Why Experts Exchange?

Experts Exchange always has the answer, or at the least points me in the correct direction! It is like having another employee that is extremely experienced.

Jim Murphy
Programmer at Smart IT Solutions

When asked, what has been your best career decision?

Deciding to stick with EE.

Mohamed Asif
Technical Department Head

Being involved with EE helped me to grow personally and professionally.

Carl Webster
CTP, Sr Infrastructure Consultant
Ask ANY Question

Connect with Certified Experts to gain insight and support on specific technology challenges including:

  • Troubleshooting
  • Research
  • Professional Opinions
Did You Know?

We've partnered with two important charities to provide clean water and computer science education to those who need it most. READ MORE