# Thread: Extracting Data from Excel

1. Registered User
Join Date
Dec 2003
Posts
5

## Unanswered: Extracting Data from Excel

Hello. I need some newbie help with a VB script in excel.

I have one worksheet, called Dates, that contains several columns, but the two columns of importance are name and date:

A B C D
1 Name Dates Age Height
2 John 12/13/2003 11 5.1
3 Sue 12/14/2003 12 5.2
4 Tom 12/15/2003 13 5.3

Sorry, I think the formatting is messed up. There are 4 columns, Name, Dates, Age, and Height.

The number of rows of data is variable, so I can have several names and dates or a few, but I can assume the maximum is 100.

On another worksheet, called Summary, I need to extract the names and dates as long as they fall under a certain timeframe, for example, within 2 days.

I want the data that is extracted to be placed in the cells A1:B10 of the Summary worksheet. I do not expect more than 10 results.

I can write a mock-up code of what should happen... but I need help with visual basic notation...

y=1
x=2
Do until x=102
If Dates!B[x] is < Current Date + 2
Summary!A[y] = Dates!A[x]
Summary!B[y] = Dates!B[x]
y = y +1
End If
x = x+1
Loop

If you can make sense of what I'm saying, your help would be appreciated. Thanks.
Last edited by Yippeeee25; 12-12-03 at 19:34.

2. Registered User
Join Date
Dec 2003
Posts
5

## Re: Extracting Data from Excel

I just solved my own problem. Thanks anyway.

Originally posted by Yippeeee25
Hello. I need some newbie help with a VB script in excel.

I have one worksheet, called Dates, that contains several columns, but the two columns of importance are name and date:

A B C D
1 Name Dates Age Height
2 John 12/13/2003 11 5.1
3 Sue 12/14/2003 12 5.2
4 Tom 12/15/2003 13 5.3

Sorry, I think the formatting is messed up. There are 4 columns, Name, Dates, Age, and Height.

The number of rows of data is variable, so I can have several names and dates or a few, but I can assume the maximum is 100.

On another worksheet, called Summary, I need to extract the names and dates as long as they fall under a certain timeframe, for example, within 2 days.

I want the data that is extracted to be placed in the cells A1:B10 of the Summary worksheet. I do not expect more than 10 results.

I can write a mock-up code of what should happen... but I need help with visual basic notation...

y=1
x=2
Do until x=102
If Dates!B[x] is < Current Date + 2
Summary!A[y] = Dates!A[x]
Summary!B[y] = Dates!B[x]
y = y +1
End If
x = x+1
Loop

If you can make sense of what I'm saying, your help would be appreciated. Thanks.

3. Registered User
Join Date
Oct 2003
Posts
1,091