Query for MS Excel or MS Access - how do I write...
Moderator: Jedi
- kittykat
- Too Much Time on my Hands
- Posts: 534
- Joined: 14th Feb, '08, 08:21
- Mood: In a state of flux
- Location: Brisneyland, Queensland
Query for MS Excel or MS Access - how do I write...
I've got something I need to test quickly to see if my logic works. I'm developing a segmentation model and want to segment a list of names based on certain criteria I've developed.
Basically it's all to do with position name and job name - based on these 2 elements I can then segment you into a group.
We've devised a list of key words that indicate what category you are segmented into. There are no duplicates obviously.
Here's a sample list:
Front Office = Category or Segment
If you have one of the following in your position name then you fall into the segment Front Office:
Demand
Contact
Client
Customer
Relationship
Sales
Service
Help Desk
Advisor
Support
I can do this in either Access or Excel but I have 28,000 records to segment. There are 6 categories (eg Front Office, Back Office, Support etc) and each category has key words that define which area they fall into.
Does anyone know how the hell I can do this?? I haven't got a clue but it must be do'able. Thanks!!
Basically it's all to do with position name and job name - based on these 2 elements I can then segment you into a group.
We've devised a list of key words that indicate what category you are segmented into. There are no duplicates obviously.
Here's a sample list:
Front Office = Category or Segment
If you have one of the following in your position name then you fall into the segment Front Office:
Demand
Contact
Client
Customer
Relationship
Sales
Service
Help Desk
Advisor
Support
I can do this in either Access or Excel but I have 28,000 records to segment. There are 6 categories (eg Front Office, Back Office, Support etc) and each category has key words that define which area they fall into.
Does anyone know how the hell I can do this?? I haven't got a clue but it must be do'able. Thanks!!
Because you're worth it...
Re: Query for MS Excel or MS Access - how do I write...
In Excel , define a range that contains the Front office key words
Name that range "Front"
next to each item in the 28,000 list use the following formula
=IF(ISNUMBER(SEARCH(Front,M9)),"Front Office","")
Do the same kind of thing for the other categories
Name that range "Front"
next to each item in the 28,000 list use the following formula
=IF(ISNUMBER(SEARCH(Front,M9)),"Front Office","")
Do the same kind of thing for the other categories
We are the TPF
Re: Query for MS Excel or MS Access - how do I write...
oh is that how that works. I'll know more after my advanced excel course I hope!
Nothing is more conducive to peace of mind than not having any opinions at all.
- Georg Christoph Lichtenberg
- Georg Christoph Lichtenberg
Re: Query for MS Excel or MS Access - how do I write...
Only one problem with your solution BoD, Search works on strings, not arrays (ranges).
Re: Query for MS Excel or MS Access - how do I write...
Funny it half works with arrays
Anyway.. somewhat less elegantly
Open a new code module
Function FindDesk(sIn As String, rDesks As Range) As String
Dim rDesk As Range
For Each rDesk In rDesks
If InStr(sIn, rDesk.Value) > 0 Then
FindDesk = rDesk.Offset(0, 1).Value
End If
Next
End Function
Create a range that looks like this somewhere
Pos1 Front Office
Pos2 Front Office
Pos3 Middle Office
Pos4 Back Office
name the first column as "postions"
In the spreadsheet - where A1 contains the postion you want to check
=FindDesk(A1,positions)
Anyway.. somewhat less elegantly
Open a new code module
Function FindDesk(sIn As String, rDesks As Range) As String
Dim rDesk As Range
For Each rDesk In rDesks
If InStr(sIn, rDesk.Value) > 0 Then
FindDesk = rDesk.Offset(0, 1).Value
End If
Next
End Function
Create a range that looks like this somewhere
Pos1 Front Office
Pos2 Front Office
Pos3 Middle Office
Pos4 Back Office
name the first column as "postions"
In the spreadsheet - where A1 contains the postion you want to check
=FindDesk(A1,positions)
Last edited by BoD on 17th Jul, '08, 17:58, edited 1 time in total.
We are the TPF
- Morrolan
- Part of the furniture
- Posts: 4118
- Joined: 14th Feb, '08, 07:30
- Mood: sceptical
- Location: Singapore
Re: Query for MS Excel or MS Access - how do I write...
alternatively: buy Access for Dummies and use that to do it in Access. worked for me.
- kittykat
- Too Much Time on my Hands
- Posts: 534
- Joined: 14th Feb, '08, 08:21
- Mood: In a state of flux
- Location: Brisneyland, Queensland
Re: Query for MS Excel or MS Access - how do I write...
Thanks HoD and Jedi. HoD you are a bit of a whizz.
M.. I'm happy to get Access for Dummies if it's in there. Is it easy to do in Access or do I need to write code and stuff??
M.. I'm happy to get Access for Dummies if it's in there. Is it easy to do in Access or do I need to write code and stuff??
Because you're worth it...
Re: Query for MS Excel or MS Access - how do I write...
I agree, a database is what you need here, not a spreadsheet. If your company can stump up the cash, FileMaker is also worth looking at, it's probably easier to get into than Access.
But first you need a big sheet of paper and work out all your fields and their relationship to each other.
But first you need a big sheet of paper and work out all your fields and their relationship to each other.
- Morrolan
- Part of the furniture
- Posts: 4118
- Joined: 14th Feb, '08, 07:30
- Mood: sceptical
- Location: Singapore
Re: Query for MS Excel or MS Access - how do I write...
pretty sure it's in there, and don't worry: you won't have to wtite code, it's pretty easy once you have the basic idea.kittykat wrote:M.. I'm happy to get Access for Dummies if it's in there. Is it easy to do in Access or do I need to write code and stuff??
Last edited by Morrolan on 18th Jul, '08, 09:19, edited 1 time in total.
- Kooky
- Can't find the exit
- Posts: 8481
- Joined: 5th Mar, '08, 13:32
- Mood: Superior
- Location: Ringside Seat
Re: Query for MS Excel or MS Access - how do I write...
Neo would argue it's better to use Excel and a bit of VB. Being a non-programmer, I'd use Access.
I used to do this kind of thing for a living; these days I struggle with an IF statement. Maybe I should use my relocation budget for some refresher courses...
I used to do this kind of thing for a living; these days I struggle with an IF statement. Maybe I should use my relocation budget for some refresher courses...
- Bender
- I post here professionally
- Posts: 2164
- Joined: 18th Feb, '08, 06:11
- Location: ɹǝpun uʍop puɐl ɐ ɯoɹɟ ǝɯoɔ ı
Re: Query for MS Excel or MS Access - how do I write...
I'd like to have a go at this - it should be easy. Can you give us:
Ideally, it'd be great to see the spreadsheet you have, can you provide a sample with personal information like names removed?
- a list of category/segment names
- for each category/segment name, a list of the words that put a person into that category/segment
Ideally, it'd be great to see the spreadsheet you have, can you provide a sample with personal information like names removed?
“The mass of men lead lives of quiet desperation.” – Henry David Thoreau
- baloo
- Can't find the exit
- Posts: 7589
- Joined: 14th Feb, '08, 00:01
- Mood: exhausted
- Location: Here, there & everywhere
Re: Query for MS Excel or MS Access - how do I write...
Surely the best way to solve this is to poke your head outside of your office door, look for the geekiest looking grad, call him into your office and explain the special assignment you have for him.
So…if you wish to wish a wish, you may swish for fish with my Ish wish dish.
- Morrolan
- Part of the furniture
- Posts: 4118
- Joined: 14th Feb, '08, 07:30
- Mood: sceptical
- Location: Singapore
Re: Query for MS Excel or MS Access - how do I write...
baloo wrote:Surely the best way to solve this is to poke your head outside of your office door, look for the geekiest looking grad, call him into your office and explain the special assignment you have for him.
Re: Query for MS Excel or MS Access - how do I write...
Huh? Jedi works at Jedi's place.