+ Reply to Thread
Results 1 to 5 of 5

Code that picks numbers out from a set

  1. #1
    Registered User
    Join Date
    05-20-2018
    Location
    Alliance,Ohio
    MS-Off Ver
    2007, 2013
    Posts
    6

    Code that picks numbers out from a set

    Hello,

    I have a cell in the same place in multiple excel files that reads like these for example:

    8-2157-2
    6-1245-3
    4569-1
    2536-2
    8745-15

    I'm trying to find some code that will pick the four digits that are together without dashes in order to use it as a row number in another excel sheet I'm making. Any ideas if this is possible?

    Thanks in advance!

    -jeff

  2. #2
    Administrator FDibbins's Avatar
    Join Date
    12-29-2011
    Location
    Duncansville, PA USA
    MS-Off Ver
    Excel 7/10/13/16/365 (PC ver 2310)
    Posts
    53,053

    Re: Code that picks numbers out from a set

    will the entries always be in that format?
    x-xxxx-x
    xxxx-x
    could you have x-xxxx?

    if you know the path and file names of the other files, you could probably do something like this...
    =MID([file1.XLSX]Sheet4!$A$2,IF(LEN([file1.XLSX]Sheet4!$A$2)-LEN(SUBSTITUTE([file1.XLSX]Sheet4!$A$2,"-",""))=2,3,1),4)
    1. Use code tags for VBA. [code] Your Code [/code] (or use the # button)
    2. If your question is resolved, mark it SOLVED using the thread tools
    3. Click on the star if you think someone helped you

    Regards
    Ford

  3. #3
    Registered User
    Join Date
    05-20-2018
    Location
    Alliance,Ohio
    MS-Off Ver
    2007, 2013
    Posts
    6

    Re: Code that picks numbers out from a set

    Thanks for the reply!

    They would never be "x-xxxx".

  4. #4
    Administrator FDibbins's Avatar
    Join Date
    12-29-2011
    Location
    Duncansville, PA USA
    MS-Off Ver
    Excel 7/10/13/16/365 (PC ver 2310)
    Posts
    53,053

    Re: Code that picks numbers out from a set

    OK good, did you try my suggested formula?

  5. #5
    Registered User
    Join Date
    05-20-2018
    Location
    Alliance,Ohio
    MS-Off Ver
    2007, 2013
    Posts
    6

    Re: Code that picks numbers out from a set

    I did! It works! Thank you! Any idea of doing it in VB? I may just assign a cell to do this formula, then call it from VB...

+ 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. picks largest value
    By andre1986 in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 01-12-2016, 12:21 PM
  2. Code picks & merges 2 sheets..Help with amending it to pick and merge 3.
    By Tyrion16 in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 10-20-2015, 12:23 PM
  3. [SOLVED] (ask) picks up number from a cells
    By GOENNE in forum Excel Formulas & Functions
    Replies: 5
    Last Post: 03-17-2014, 12:09 PM
  4. I need to look up how much time a employee picks
    By superchew in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 10-29-2013, 09:47 AM
  5. [SOLVED] VBA code to import pick'em picks into master sheet
    By chadwick140 in forum Excel Programming / VBA / Macros
    Replies: 27
    Last Post: 08-29-2013, 01:18 PM
  6. vlookup only picks up first match
    By semantics in forum Excel Formulas & Functions
    Replies: 4
    Last Post: 02-13-2013, 02:19 PM
  7. Excel 2007 : auto calculate picks
    By runball in forum Excel General
    Replies: 1
    Last Post: 09-16-2009, 10:19 AM

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