Lookup a number, return a name

bobbybrown

Board Regular
Joined
Apr 17, 2015
Messages
121
Hi all,
I’m working on a simple sheet where I have a few columns. The important ones are:
A = first name
B = surname
F = points

On another sheet within the same workbook I am trying to get it to display any person who has 3 or more points.
I want it to display first name, surname and points if they have 3 or more points.
This sheet is a summary sheet if that makes sense.

I’ve tried with Vlookup but I just keep getting an error or a 0, so thought I should ask the experts for guidance.

Many thanks
 

Excel Facts

Using Function Arguments with nested formulas
If writing INDEX in Func. Arguments, type MATCH(. Use the mouse to click inside MATCH in the formula bar. Dialog switches to MATCH.
Code:
Option Explicit


Sub BobbyBrown()
    Dim s1 As Worksheet, s2 As Worksheet
    Set s1 = Sheets("ABF")    'Change name to your sheet name
    Set s2 = Sheets("Summary")    'Change name to your summary Sheet name
    Dim i As Long, lr As Long, lr2 As Long
    Application.ScreenUpdating = False
    lr = s1.Range("A" & Rows.Count).End(xlUp).Row
    With s1
        For i = 1 To lr
            lr2 = s2.Range("A" & Rows.Count).End(xlUp).Row + 1
            If .Range("F" & i) >= 3 Then
                Application.Union(.Range("A" & i), .Range("B" & i), .Range("F" & i)).Copy
                s2.Range("A" & lr).PasteSpecial xlPasteValues
            End If
        Next i
    End With
   Application.CutCopyMode = False
   Application.ScreenUpdating = True
   MsgBox "completed action"

    End Sub
 
Last edited:
Upvote 0
Thanks I’ll give that a try!
It will eventually be going on to google sheets as that is what my employer uses, if they don’t support the code is there a way to do the same job with formulas?

I’ll let you know if that works.
 
Upvote 0
It is saying completed action, but the summary sheet is blank.
Columns ABC are highlighted but there’s nothing in them.
 
Upvote 0
Suggest you post your worksheet to a location like Box.net or Dropbox for testing. Cannot help without actually seeing your worksheet and determining the issue.

This line of code s2.Range("A" & lr).PasteSpecial xlPasteValues

needs to read
s2.Range("A" & lr2).PasteSpecial xlPasteValues

My apologies
 
Last edited:
Upvote 0
Sample worksheet is on the way.
What I am trying to do is get the first name, surname and amount of sickness occasions to display on the summary sheet.
It should become clear once you see the sheets.
 
Upvote 0
B
C
D
2
Colleagues with 3 or more sickness within 6 months
3
4
First Name
Surname
Occasions of sickness
5
Name 3Surname 3
3​
6
Name 6Surname 6
4​
7
Name 10Surname 10
4​
8
9
10
11
12
13
14
15
16
17
18

<tbody>
</tbody>



B5=
IFERROR(INDEX('Sickness Tracker'!A$6:A$129,SMALL(IF('Sickness Tracker'!$F$6:$F$129>=3,ROW('Sickness Tracker'!A$6:A$129)-ROW('Sickness Tracker'!A$6)),ROWS('Sickness Tracker'!A$6:'Sickness Tracker'!A6))),""

control+shift+enter

copy across and down
 
Last edited:
Upvote 0
That is so close! It seems to be copying the row above. If name 4 should be copied then it is copying name 3
 
Upvote 0

Forum statistics

Threads
1,214,920
Messages
6,122,279
Members
449,075
Latest member
staticfluids

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