# separate tickets based on where they originated

1. ## separate tickets based on where they originated

Hello,
I'm trying to find an equation that can seperate ticket numbers based on where the ticket originated - for example, say a ticket number 'S34589' comes from Seattle and 'T20790' comes from Tacoma, and a third 'ST108' is from Sea-Tac - is there a way to write something up that can seperate those in a seperate column and call out which city the tickets came from? I've tried one way where if the ticket contains 's' then return Seattle; but if the ticket contains both s and t it doesn't know to write in SeaTac. Thanks for any help!

2. Hi minkus,

I would think you could create a lookup table to do this, and use a nested if/vlookup to find the first 1 or 2 characters in the list.

How many different "originations" are there? And do they always have either 1 or 2 letters at the beginning? Do any have 3, 4, or more?

If you had a table that had all of your origination codes ("S", "T", "ST", etc.) in column A, and their associated city in column B, you could use something like:

``Please Login or Register  to view this content.``
This basically says that if Excel returns an error looking for the first character in the lookup table, then return a match for the first two characters, otherwise return a match for just the first character. Hopefully that makes sense and helps you in your efforts.

3. ## re: separate tickets based on where they originated

Size does matter.
Small error (I think). I think it should be
=IF(ISNA(VLOOKUP(LEFT(A1;2);Sheet2!\$A\$1:\$B\$20;2;0));VLOOKUP(LEFT(A1;1);Sheet2!\$A\$1:\$B\$20;2;0);VLOOKUP(LEFT(A1;2);Sheet2!\$A\$1:\$B\$20;2;0))

As it will look for the first two characters first. If this is S1 e.g. than #N/A and it will only search for the first character.

4. I stand corrected, now I see what happens when I use my brain. Thanks rwg.

Minkus, just remember to use your version of Excel's normal argument separator (a comma vs. a semi-colon). In English versions of Excel, a comma is used (see my formula), while in a number of non-English versions a semi-colon is used (see rwg's formula).

5. Perfect! Thanks for your help

There are currently 1 users browsing this thread. (0 members and 1 guests)

#### Posting Permissions

• You may not post new threads
• You may not post replies
• You may not post attachments
• You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1