Advanced filter with wildcard

chef

Well-known Member
Joined
Jul 10, 2002
Messages
610
Office Version
  1. 365
  2. 2016
Hello all
I am trying all sorts with wildcard and I have not really used advanced filter but am in a muddle trying

I have a dataset in a sheet called staff
column A has Forename Column B has Surname Column C has staff ID no and Column D has dept

I would like in a separate sheet called Interface

Copy the headings over but to be able to use a wildcard in b3 for Surname and then have all displayed below the results from filter

eg if i just typed in "sm" for example or "cr" into b3 the results below would show staff details

with forename/surename/ID/Dept etc for smith/smyth/smithers etc or Crompton/Crieff..depending on letters I put in cell b3

so trying to use autotype to filter out the surnames with what i type in cell b3 then show results from datasets. I can then just click on the staff ID then will take me to another page to display full staff details
I am ok with that, but just looking for help re advanced filter and formula that allows me to type in first few letters as user does not always know full surname plus there could be more than one smith/smithers etc

hope makes sense and any suggestions appreciated
 

Excel Facts

Best way to learn Power Query?
Read M is for (Data) Monkey book by Ken Puls and Miguel Escobar. It is the complete guide to Power Query.
Is it possible that you post a 5 row fake sample with headers included and a specification of the output you would want to obtain from that sample?
 
Upvote 0
Hi Aladin
so..

Forename Surname ID Dept
Joe Smith T1234 Medicine
Brian Smyth T1235 Surgery
Alison Crieff T1236 Surgery
Fiona Smith T1237 Cardio
Derek Dobson T1238 Operations

so if I type the letter s in say cell b3

then the details for smith and smyth would appear in colums below and user could then choose ID no
If I type in Smith then only smith would appear
or if d then dobson would appear

hope makes sense as 14000 staff and would help to filter our choice
regards
ian
 
Upvote 0
This can be done either with formulas or with vba that reacts on the choices the user makes. If it's the latter what you are after, someone into vba should, I hope, take this up.
 
Upvote 0
Hi Aladin
My preference would be to try and do by formula as I'm not great experience with VBA but any suggestions at all by anyone would be greatly appreciated.
Many thanks again for quick reply
regards
ian
 
Upvote 0

Book1
ABCD
1ForenameSurnameIDDept
2JoeSmithT1234Medicine
3BrianSmythT1235Surgery
4AlisonCrieffT1236Surgery
5FionaSmithT1237Cardio
6DerekDobsonT1238Operations
data


Name the range in column A fname via the Name Box or in the Name Manager.

Name the range in column B sname via the Name Box or in the Name Manager.

Name the range in column C id via the Name Box or in the Name Manager.

Name the range in column D dep via the Name Box or in the Name Manager.

Define ivec in the Name Manager as referring to:
Rich (BB code):
=ROW(sname)-ROW(INDEX(sname,1,1))+1


Book1
ABCDEF
2
3sm3select id from below
4idxsurnameidT1234
51SmithT1234
62SmythT1235
74SmithT1237
8
9
10
11
interface


In C3 enter:
Rich (BB code):
=COUNTIFS(data!$B$2:$B$6,$B3&"*")

In B5 enter and copy down:
Rich (BB code):
=IF(ROWS($B$5:B5)>$C$3,"",AGGREGATE(15,6,ivec/ISNUMBER(SEARCH("|"&$B$3,"|"&sname)),ROWS($B$5:B5)))

In C3 enter and copy down:
Rich (BB code):
=IF($B5="","",INDEX(sname,$B5))

In D3 enter and copy down:
Rich (BB code):
=IF($B5="","",INDEX(id,$B5))

Define idlist in the Name Manager as referring to:
Rich (BB code):
=OFFSET(interface!$D$5,0,0,interface!$C$3)

Data validate E4 as List with Source set to:
Rich (BB code):
=idlist

Name E3 as idselection via the Name Box or the Name Manager.


Book1
ABC
1ID
2T1234
3ForenameSurnameDept
4JoeSmithMedicine
5
filter


In A2 enter:
Rich (BB code):
=idselection

In A4 enter:
Rich (BB code):
=IF($A2="","",VLOOKUP($A2,CHOOSE({1,2},id,fname),2,0))

In B4 enter:
Rich (BB code):
=IF($A2="","",VLOOKUP($A2,CHOOSE({1,2},id,sname),2,0))

In C4 enter:
Rich (BB code):
=IF($A2="","",VLOOKUP($A2,CHOOSE({1,2},id,dep),2,0))
 
Upvote 0
Aladin,
are you serious!
wow...that worked first time and you are a genius....I have no idea how you could even think to come up with that.

I am so so grateful for your time and help and also just amazed at how you put that soultion together.
Brilliant...

this is going to make users life so much easier to navigate around
Cannot thank you enough and also thank you for step by step instuctions on how to map it all out.

Have a great day
kind regards
ian
 
Upvote 0

Forum statistics

Threads
1,223,893
Messages
6,175,239
Members
452,621
Latest member
Laura_PinksBTHFT

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