View Single Post
  #4   Report Post  
srm6 srm6 is offline
Junior Member
 
Posts: 4
Default

Quote:
Originally Posted by Claus Busch View Post
hi,

Am Mon, 11 Mar 2013 21:10:34 +0000 schrieb srm6:

Sheet 1
Name Location Code Task Answer should be:
{Formula Here} IL001 010 Bob
{Formula Here} IL001 009 Bill
{Formula Here} IL002 008 Diane
{Formula Here} IL002 007 Tina
{Formula Here} IL003 006 Bill
{Formula Here} IL004 005 Tina
{Formula Here} IL004 004 Bob
{Formula Here} IL005 003 Diane
{Formula Here} IL006 002 Tina
{Formula Here} IL007 001 Bob
{Formula Here} IL008 000 Diane

Sheet 2
Location Code Task Name
IL008 000 Diane
IL007 001 Bob
IL006 002 Tina
IL005 003 Diane
IL004 004 Bob
IL004 005 Tina
IL003 006 Bill
IL002 007 Tina
IL002 008 Diane
IL001 009 Bill
IL001 010 Bob


try:
=INDEX(Sheet2!$C$2:$C$200,MATCH(B2&C2,Sheet2!$A$2: $A$200&Sheet2!$B$2:$B$200,0))
and enter the array formula with CRTL+Shift+Enter


Regards
Claus Busch
--
Win XP PRof SP2 / Vista Ultimate SP2
Office 2003 SP2 /2007 Ultimate SP2

Thank you Claus Busch. This worked perfectly. However, when I put it into my spreadsheet consisting of 19804 rows it bogged down the report and took forever for me to run the existing macro I have in the report. Is there a way to add this to an existing macro so it will run faster?

My existing macro is as follows:

Sub CopyData3()
Application.ScreenUpdating = False
Dim vNames, vSheets, lLastRow&, n&, c As Range
Const sNames$ = "brad,casey,dave,dott,jason,jesus,rick,russ"
Const sSheets$ = "brad,casey,dave,dott,jason,jesus,rick,russ"
vNames = Split(sNames, ","): vSheets = Split(sSheets, ",")
lLastRow = Sheets("Raw Data").Range("A" & Rows.Count).End(xlUp).Row
With Sheets("Raw Data")
For n = LBound(vNames) To UBound(vNames)
For Each c In .Range("A2:A" & lLastRow)
If c = vNames(n) And c.Offset(0, 4) <= Date _
And c.Offset(0, 6) = "" Then
.Range(Cells(c.Row, 1), Cells(c.Row, 5)).Copy _
Sheets(vSheets(n)).Cells(Rows.Count, _
"A").End(xlUp).Offset(1, 0)
End If 'c = vNames(n)
Next 'c
Next 'n
End With 'Sheets("Raw Data")
Application.ScreenUpdating = True
End Sub 'CopyData3

The macro is taking my raw data and splitting the information up into seperate sheets based on the date and the user name.

The formula will only exist in the raw data. The copydata macro will then use that information to determine what data goes into which sheet.

Eventually I would like the macro to create the sheet for each user but for now this one works. I just need to get that formula into the macro. Thanks for your help.