Results 1 to 7 of 7
  1. #1
    lwilt is offline Novice
    Windows XP Access 2010 32bit
    Join Date
    Sep 2013
    Posts
    7

    Pull out part of the string within the cell


    I'm trying to find a function in access that could do the following:

    ZAB103-3012
    ZAF405-HD-0001

    Turn those cells into:

    AB103
    AF405-HD

    Pulling everything to the right of the Z in the last step is the easy part but I can't figure out what function would be able to find the last "-" in the cell and pull everything to the left of it. Please tell me how this can be done.

    thanks
    -Logan

  2. #2
    RuralGuy's Avatar
    RuralGuy is offline Administrator
    Windows 7 64bit Access 2013
    Join Date
    Mar 2007
    Location
    8300' in the Colorado Rocky Mountains
    Posts
    12,922
    Have you looked at the InStrRev() function?

  3. #3
    lwilt is offline Novice
    Windows XP Access 2010 32bit
    Join Date
    Sep 2013
    Posts
    7
    Couldn't get it to work but I may have tried an incorrect formula....any idea what the formula should be?

  4. #4
    RuralGuy's Avatar
    RuralGuy is offline Administrator
    Windows 7 64bit Access 2013
    Join Date
    Mar 2007
    Location
    8300' in the Colorado Rocky Mountains
    Posts
    12,922
    What did you try?

  5. #5
    lwilt is offline Novice
    Windows XP Access 2010 32bit
    Join Date
    Sep 2013
    Posts
    7
    InStrRev([Cell being Searched],"-")

    So in the example it returns a 5 but then how would I use the midpoint function to pull everything left of that number that is returned because the length of each cell is different

  6. #6
    lwilt is offline Novice
    Windows XP Access 2010 32bit
    Join Date
    Sep 2013
    Posts
    7
    OHH never mind I think that should work. I didn't realize it was giving me the character number going left to right so now I can just use the midpoint function going from 2 to the number InStrRev() returns.

    Does that sound right?

  7. #7
    RuralGuy's Avatar
    RuralGuy is offline Administrator
    Windows 7 64bit Access 2013
    Join Date
    Mar 2007
    Location
    8300' in the Colorado Rocky Mountains
    Posts
    12,922
    How about: Mid([Cell being Searched], 2, InStrRev([Cell being Searched], "-") - 2)

Please reply to this thread with any new information or opinions.

Similar Threads

  1. Replies: 1
    Last Post: 07-12-2013, 01:48 PM
  2. Returning part of a string
    By dr4ke in forum Queries
    Replies: 7
    Last Post: 01-15-2013, 11:21 AM
  3. Replies: 7
    Last Post: 02-29-2012, 06:37 AM
  4. matching part of the string from two columns
    By hoachen in forum Queries
    Replies: 4
    Last Post: 12-20-2011, 01:54 PM
  5. Can we post Access cell data to Excel cell properties?
    By Zethro in forum Import/Export Data
    Replies: 1
    Last Post: 12-13-2005, 08:42 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Other Forums: Microsoft Office Forums