VLOOKUP - Need formula?

Kapz786

New Member
Joined
Aug 14, 2017
Messages
2
Hi Guys

Looking to use a formula - probably VLOOKUP - My sheat is a much larger version of the below table that lists employee's first name, surname and then all the dates for a year. I then enter if someone is "A" for "Available", AM for "Available AM only" or PM for "Available PM only".

What I want to do is have a formula where I can just enter a date such as 04-07 below and it will display the 2 employee's who have listed any of A, AM or PM. Would be great if it can be done with both first name and surname (they are on 2 different columns)
[TABLE="width: 500"]
<tbody>[TR]
[TD]First Name[/TD]
[TD]Surname[/TD]
[TD][/TD]
[TD]01-07[/TD]
[TD]02-07[/TD]
[TD]03-07[/TD]
[TD]04-07[/TD]
[TD]05-07[/TD]
[TD]06-07[/TD]
[TD]07-07[/TD]
[/TR]
[TR]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD]John[/TD]
[TD]Smith[/TD]
[TD][/TD]
[TD][/TD]
[TD]A[/TD]
[TD][/TD]
[TD]AM[/TD]
[TD][/TD]
[TD]PM[/TD]
[TD]A[/TD]
[/TR]
[TR]
[TD]Sam[/TD]
[TD]Black[/TD]
[TD][/TD]
[TD][/TD]
[TD]PM[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD]Bill[/TD]
[TD]White[/TD]
[TD][/TD]
[TD]A[/TD]
[TD][/TD]
[TD][/TD]
[TD]A[/TD]
[TD]PM[/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD]James[/TD]
[TD]Blue[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD]AM[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/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]
 

Excel Facts

Round to nearest half hour?
Use =MROUND(A2,"0:30") to round to nearest half hour. Use =CEILING(A2,"0:30") to round to next half hour.
Sorry I should say I need it to list all the employee's which could be up to 20 or so - in this example for 04-07 it is just 2 persons
 
Upvote 0
Hi, welcome to the forum.

See if you can adapt this to your set-up. The formula in L2 is a helper formula to aid efficiency - the formulas in M2 and N2 can be copied down as required.


Excel 2013/2016
ABCDEFGHIJKLMN
1First NameSurname01-Jul02-Jul03-Jul04-Jul05-Jul06-Jul07-JulDateHelper1st NameSurname
2JohnSmithAAMPMA04-Jul2JohnSmith
3SamBlackPMBillWhite
4BillWhiteAAPM
5JamesBlueAM
Sheet1
Cell Formulas
RangeFormula
L2=SUM(COUNTIF(INDEX($C$2:$I$1000,0,MATCH(K2,C1:I1,0)),{"A","AM","PM"}))
M2=IF(ROWS(M$2:M2)>$L$2,"",INDEX($A$2:$A$1000,AGGREGATE(15,6,(ROW($A$2:$A$1000)-ROW($A$2)+1)/ISNUMBER(MATCH(INDEX($C$2:$I$1000,0,MATCH($K$2,$C$1:$I$1,0)),{"AM","PM","A"},0)),ROWS(M$2:M2))))
N2=IF(ROWS(N$2:N2)>$L$2,"",INDEX($B$2:$B$1000,AGGREGATE(15,6,(ROW($B$2:$B$1000)-ROW($B$2)+1)/ISNUMBER(MATCH(INDEX($C$2:$I$1000,0,MATCH($K$2,$C$1:$I$1,0)),{"AM","PM","A"},0)),ROWS(N$2:N2))))
 
Upvote 0
Can you use something like this? Assume your data range (including headings) is A1:I5. Your formula for quantity is in C8. Your formula for Name is in D8. Your formula for surname is in E8. Make sure you take off the $ for the Column, so you can copy across and down to get your additional name and surname. Also copy down from E8 to get your next surname. For these formulas, you must use Cntrl+Shift+Enter. The formula in c8 is [TABLE="width: 64"]
<tbody>[TR]
[TD="width: 64"] =SUM(IF($C$1:$I$1=$A$8,IF($C$2:$I$5<>"",1)))[/TD]
[/TR]
</tbody>[/TABLE]
The formula for D8 is [TABLE="width: 64"]
<tbody>[TR]
[TD="width: 64"] =INDEX(A$2:A$5,SMALL(IF($C$1:$I$1=$A$8,IF($C$2:$I$5<>"",ROW($A$2:$A$5)-ROW($A$2)+1)),ROWS($D$8:D8)))

[TABLE="width: 660"]
<colgroup><col span="2"><col span="8"></colgroup><tbody>[TR]
[TD]First Name[/TD]
[TD]Surname[/TD]
[TD="align: right"]7/1[/TD]
[TD="align: right"]7/2[/TD]
[TD="align: right"]7/3[/TD]
[TD="align: right"]7/4[/TD]
[TD="align: right"]7/5[/TD]
[TD="align: right"]7/6[/TD]
[TD="align: right"]7/7[/TD]
[TD][/TD]
[/TR]
[TR]
[TD]John[/TD]
[TD]Smith[/TD]
[TD][/TD]
[TD]A[/TD]
[TD][/TD]
[TD]AM[/TD]
[TD][/TD]
[TD]PM[/TD]
[TD]A[/TD]
[TD][/TD]
[/TR]
[TR]
[TD]Sam[/TD]
[TD]Black[/TD]
[TD][/TD]
[TD]PM[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD]Bill[/TD]
[TD]White[/TD]
[TD]A[/TD]
[TD][/TD]
[TD][/TD]
[TD]A[/TD]
[TD]PM[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD]James[/TD]
[TD]Blue[/TD]
[TD][/TD]
[TD][/TD]
[TD]AM[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD]Date[/TD]
[TD][/TD]
[TD]Quantity[/TD]
[TD]Name1[/TD]
[TD]Surname[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD="align: right"]7/4[/TD]
[TD][/TD]
[TD="align: right"]2[/TD]
[TD]John[/TD]
[TD]Smith[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD]Bill[/TD]
[TD]White[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
</tbody>[/TABLE]
[/TD]
[/TR]
</tbody>[/TABLE]
 
Upvote 0

Forum statistics

Threads
1,224,823
Messages
6,181,181
Members
453,022
Latest member
Mohamed Magdi Tawfiq Emam

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