If value in column x and y is greater than 2 list all names

Fazila

Board Regular
Joined
Nov 19, 2014
Messages
163
I know I have asked this question previously and I really can't figure out a way to do this so thought I would try this amazing forum again :)

I need to populate the table below:

[TABLE="width: 500"]
<tbody>[TR]
[TD]Last Name[/TD]
[TD]First Name[/TD]
[TD]Reg Group[/TD]
[TD]Art Group[/TD]
[TD]Art Teacher[/TD]
[TD]Art Target[/TD]
[TD]Art EFG[/TD]
[TD]Art EFG-FFT[/TD]
[TD]Art Effort[/TD]
[TD]Art Homework[/TD]
[/TR]
[TR]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
</tbody>[/TABLE]

The base data is on a sheet called "Raw Data excel"

I need to copy the data for the above columns across if the Effort and Homework grade is greater than 2 (i.e. 3 or 4). This means I need to filter out 1, 2, U and blanks.

Is there a way this can be done?

I have tried

=IF(AND(INDEX(RawData,0,MATCH($J$1,RawDataHeadings,0)),INDEX(RawData,0,MATCH($K$1,RawDataHeadings,0)))=">2",INDEX(RawData,0,MATCH(A$3,RawDataHeadings,0)),"")

But no such luck

I do have a macro that copies all data across matching the above columns but I can't seem to add the filter in. The macro is:

Code:
Sub CopyStudent() 
Dim intErrCount As Integer
 
' create worksheet objects
Dim shtSource As Worksheet: Set shtSource = Sheets("Raw Data excel")
Dim shtTarget As Worksheet: Set shtTarget = ActiveSheet
 
' create range objects
Dim rngSourceHeaders As Range: Set rngSourceHeaders = shtSource.Range("2:2")
 
With shtTarget
    Dim rngTargetHeaders As Range: Set rngTargetHeaders = .Range("A" & ActiveCell.Row).Resize(, 10)
    Dim rngPastePoint As Range: Set rngPastePoint = .Cells(.Rows.Count, 1).End(xlUp).Offset(1) 'Shoots up from the bottom of the sheet untill it bumps into something and steps one down
End With
 
Dim rngDataColumn As Range
 
' process data
      
Dim cl As Range, i As Integer
   
For Each cl In rngTargetHeaders ' loop through each cell in target header row
   
    ' identify source location
    i = 0 ' reset I
    On Error Resume Next ' ignore errors, these are where the value can't be found and will be tested later
        i = Application.Match(cl.Value, rngSourceHeaders, 0) 'Finds the matching column name
    On Error GoTo 0 ' switch error handling back off
   
    ' report if source location not found
    If i = 0 Then
        intErrCount = intErrCount + 1
        Debug.Print "unable to locate item [" & cl.Value & "] at " & cl.Address ' this reports to Immediate Window (Ctrl + G to view)
        GoTo nextCL
    End If
   
    ' create source data range object
    With rngSourceHeaders.Cells(1, i)
        Set rngDataColumn = Range(.Cells(2, 1), .Cells(1000000, 1).End(xlUp))
    End With
   
    ' pass to target range object
    cl.Offset(1, 0).Resize(rngDataColumn.Rows.Count, rngDataColumn.Columns.Count).Value = rngDataColumn.Value
   
nextCL:
Next cl
 
' confirm process completion and issue any warnings
If intErrCount = 0 Then
    MsgBox "process completed"
    
End If


End Sub

I wish I could claim credit for the above but it was something I found online and considering my woeful ignorance I can't seem to manipulate it very much.

Any help would be appreciated. Ideally I want something that would automate the whole process so if the base data changes it will automatically update the table above.

Thanks again for all your help.

Fazila
 
Last edited:

Excel Facts

Get help while writing formula
Click the italics "fx" icon to the left of the formula bar to open the Functions Arguments dialog. Help is displayed for each argument.
Share the column headings of the "Raw Data excel" sheet. And data from which column in the "Raw Data excel" sheet is going to which column in the Output Sheet!
 
Last edited by a moderator:
Upvote 0
@KolGuyXcel
Please do not quote whole posts, as it's unneccesary & makes threads harder to read.
 
Upvote 0
There are quite a few columns but the main ones I need to look at:

[TABLE="width: 500"]
<tbody>[TR]
[TD]A[/TD]
[TD]B[/TD]
[TD]C[/TD]
[TD]D[/TD]
[TD]E[/TD]
[TD]F[/TD]
[TD]G[/TD]
[TD]H[/TD]
[TD]I[/TD]
[TD]J[/TD]
[TD]K[/TD]
[TD]L[/TD]
[TD]M[/TD]
[TD]N[/TD]
[TD]O[/TD]
[TD]P[/TD]
[TD]Q[/TD]
[TD]R[/TD]
[TD]S[/TD]
[TD]T[/TD]
[TD]U[/TD]
[TD]V[/TD]
[TD]W[/TD]
[TD]X[/TD]
[TD]Y[/TD]
[/TR]
[TR]
[TD]UPN[/TD]
[TD]Last Name[/TD]
[TD]First Name[/TD]
[TD]Reg[/TD]
[TD]Gender[/TD]
[TD]Ethnicity[/TD]
[TD]FSM[/TD]
[TD]PP[/TD]
[TD]PA[/TD]
[TD]Eng Teacher[/TD]
[TD]Eng Group[/TD]
[TD]Eng FFT Target[/TD]
[TD]Eng EFG[/TD]
[TD]Eng EFG - FFT[/TD]
[TD]Ma Teacher[/TD]
[TD]Ma Group[/TD]
[TD]Ma FFT[/TD]
[TD]Ma EFG[/TD]
[TD]Ma FFT - EFG[/TD]
[TD]Eng Effort[/TD]
[TD]Ma Effort[/TD]
[TD]Eng Homework[/TD]
[TD]Ma Homework[/TD]
[TD]Eng Organisation[/TD]
[TD]Ma Organisation[/TD]
[/TR]
[TR]
[TD]A1234[/TD]
[TD]Smith[/TD]
[TD]Dan[/TD]
[TD]11.1[/TD]
[TD]M[/TD]
[TD]British[/TD]
[TD]N[/TD]
[TD]Y[/TD]
[TD]Mid[/TD]
[TD]Ms Patel[/TD]
[TD]11a/En[/TD]
[TD]4[/TD]
[TD]5[/TD]
[TD]1[/TD]
[TD]Mr Singh[/TD]
[TD]11a/Ma[/TD]
[TD]6[/TD]
[TD]5[/TD]
[TD]-1[/TD]
[TD]2[/TD]
[TD]3[/TD]
[TD]1[/TD]
[TD]2[/TD]
[TD]2[/TD]
[TD]2[/TD]
[/TR]
</tbody>[/TABLE]

The columns I will need will depend on the department but will be:

[TABLE="width: 500"]
<tbody>[TR]
[TD]A[/TD]
[TD]B[/TD]
[TD]C[/TD]
[TD]D[/TD]
[TD]E[/TD]
[TD]F[/TD]
[TD]G[/TD]
[TD]H[/TD]
[TD]I[/TD]
[TD]J[/TD]
[TD]K[/TD]
[TD]L[/TD]
[TD]M[/TD]
[/TR]
[TR]
[TD]Last Name[/TD]
[TD]First Name[/TD]
[TD]Reg[/TD]
[TD]Eng Group[/TD]
[TD]Eng Teacher[/TD]
[TD]Eng FFT[/TD]
[TD]Eng EFG[/TD]
[TD]Eng EFG - FFT[/TD]
[TD]Eng Effort[/TD]
[TD]Eng Homework[/TD]
[TD]Action CTL[/TD]
[TD]Action PAL[/TD]
[TD]Action Teacher[/TD]
[/TR]
[TR]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
</tbody>[/TABLE]

Any help would be really really appreciated.

Thanks :)
 
Upvote 0

Forum statistics

Threads
1,224,823
Messages
6,181,181
Members
453,021
Latest member
Justyna P

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