+ Reply to Thread
Results 1 to 5 of 5

separate tickets based on where they originated

  1. #1
    Registered User
    Join Date
    05-17-2007
    Posts
    45

    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. #2
    Forum Expert Paul's Avatar
    Join Date
    02-05-2007
    Location
    Wisconsin
    MS-Off Ver
    2016/365
    Posts
    6,885
    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. #3
    Valued Forum Contributor rwgrietveld's Avatar
    Join Date
    09-02-2008
    Location
    Netherlands
    MS-Off Ver
    XL 2007 / XL 2010
    Posts
    1,671

    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.
    Looking for great solutions but hate waiting?
    Seach this Forum through Google

    www.Google.com
    (e.g. +multiple +IF site:excelforum.com/excel-general/ )

    www.Google.com
    (e.g. +fill +combobox site:excelforum.com/excel-programming/ )

    Ave,
    Ricardo

  4. #4
    Forum Expert Paul's Avatar
    Join Date
    02-05-2007
    Location
    Wisconsin
    MS-Off Ver
    2016/365
    Posts
    6,885
    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).
    Last edited by Paul; 09-22-2008 at 06:50 PM.

  5. #5
    Registered User
    Join Date
    05-17-2007
    Posts
    45
    Perfect! Thanks for your help

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. Replies: 1
    Last Post: 06-02-2015, 12:28 AM
  2. Generating report based on and consisting of rows in worksheets
    By esthero101 in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 03-13-2008, 11:05 PM
  3. Replies: 3
    Last Post: 02-05-2008, 11:13 AM
  4. Changing rowsource of 2 listboxes based on 3rd listbox.
    By scadaman29325 in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 01-09-2008, 11:20 AM
  5. Replies: 4
    Last Post: 10-11-2007, 01:58 PM

Bookmarks

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