Query for MS Excel or MS Access - how do I write...

Bits, Bytes & Bootstraps

Moderator: Jedi

Locked
User avatar
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...

Post by kittykat » 17th Jul, '08, 14:46

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!!
Because you're worth it...

User avatar
BoD
Part of the furniture
Posts: 4052
Joined: 14th Feb, '08, 09:44

Re: Query for MS Excel or MS Access - how do I write...

Post by BoD » 17th Jul, '08, 15:18

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
We are the TPF

User avatar
Tas
I live here
Posts: 3505
Joined: 18th Feb, '08, 11:53
Mood: Confuddled

Re: Query for MS Excel or MS Access - how do I write...

Post by Tas » 17th Jul, '08, 16:22

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

User avatar
Jedi
Going Postal
Posts: 1496
Joined: 14th Feb, '08, 12:44
Mood: What evs
Location: Land Down Under

Re: Query for MS Excel or MS Access - how do I write...

Post by Jedi » 17th Jul, '08, 17:03

Only one problem with your solution BoD, Search works on strings, not arrays (ranges).

User avatar
BoD
Part of the furniture
Posts: 4052
Joined: 14th Feb, '08, 09:44

Re: Query for MS Excel or MS Access - how do I write...

Post by BoD » 17th Jul, '08, 17:26

Good point..hang on a min
We are the TPF

User avatar
BoD
Part of the furniture
Posts: 4052
Joined: 14th Feb, '08, 09:44

Re: Query for MS Excel or MS Access - how do I write...

Post by BoD » 17th Jul, '08, 17:42

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)
Last edited by BoD on 17th Jul, '08, 17:58, edited 1 time in total.
We are the TPF

User avatar
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...

Post by Morrolan » 17th Jul, '08, 17:55

alternatively: buy Access for Dummies and use that to do it in Access. worked for me. ;)

User avatar
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...

Post by kittykat » 17th Jul, '08, 20:22

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??
Because you're worth it...

User avatar
Burbage
Part of the furniture
Posts: 4625
Joined: 17th Feb, '08, 17:07
Mood: Litotic

Re: Query for MS Excel or MS Access - how do I write...

Post by Burbage » 18th Jul, '08, 06:23

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.

User avatar
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...

Post by Morrolan » 18th Jul, '08, 08:15

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??
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.
Last edited by Morrolan on 18th Jul, '08, 09:19, edited 1 time in total.

User avatar
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...

Post by Kooky » 18th Jul, '08, 08:31

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. :cry: Maybe I should use my relocation budget for some refresher courses...

User avatar
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...

Post by Bender » 18th Jul, '08, 09:08

I'd like to have a go at this - it should be easy. Can you give us:
  • a list of category/segment names
  • for each category/segment name, a list of the words that put a person into that category/segment
And tell us if a person can be a member of more than one 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

User avatar
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...

Post by baloo » 18th Jul, '08, 09:09

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.

User avatar
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...

Post by Morrolan » 18th Jul, '08, 09:53

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.
[smilie=rotflmao.gif]

User avatar
BoD
Part of the furniture
Posts: 4052
Joined: 14th Feb, '08, 09:44

Re: Query for MS Excel or MS Access - how do I write...

Post by BoD » 18th Jul, '08, 09:59

Jedi works at KK's place?
We are the TPF

User avatar
Jedi
Going Postal
Posts: 1496
Joined: 14th Feb, '08, 12:44
Mood: What evs
Location: Land Down Under

Re: Query for MS Excel or MS Access - how do I write...

Post by Jedi » 18th Jul, '08, 10:21

Huh? Jedi works at Jedi's place.

Locked