+ Reply to Thread
Results 1 to 8 of 8

Need a formula\function that return first and last value within range of numbers

  1. #1
    Registered User
    Join Date
    11-13-2020
    Location
    Israel
    MS-Off Ver
    office 2016
    Posts
    7

    Need a formula\function that return first and last value within range of numbers

    Hello everybody,
    Hope you can help me with this one:

    I have a cell (lets say A1) with different values (inside the cell) consist with a letters and numbers and they all separated with comma and space like this:
    C1, C2, C3, XB5, C4, XB3, C5, XB4, L8, C10

    I need a formula\function that return first and last value within a range of values inside the cell and write them in 2 separated (lets say B and C) columns like this:
    C1 C5
    C10 C10
    L8 L8
    XB3 XB5

    *L8 and C10 don't have a follow or lead values so the rage is from L8 to L8 and C10 to C10.

    Thanks in advance.

  2. #2
    Forum Moderator Glenn Kennedy's Avatar
    Join Date
    07-08-2012
    Location
    Digital Nomad... occasionally based in Ireland.
    MS-Off Ver
    O365 (PC) V 2406
    Posts
    44,662

    Re: Need a formula\function that return first and last value within range of numbers

    Please attach a sample worksheet. It's really impossible to see what is meant to be in which cell. Refer to the yellow banner (top) for instructions on attaching an Excel file.
    Glenn




    None of us get paid for helping you... we do this for fun. So DON'T FORGET to say "Thank You" to all who have freely given some of their time to help YOU

  3. #3
    Registered User
    Join Date
    11-13-2020
    Location
    Israel
    MS-Off Ver
    office 2016
    Posts
    7

    Re: Need a formula\function that return first and last value within range of numbers

    Hi,
    Thank you for your reply.
    I uploaded an xl sample.
    Attached Files Attached Files

  4. #4
    Forum Moderator Glenn Kennedy's Avatar
    Join Date
    07-08-2012
    Location
    Digital Nomad... occasionally based in Ireland.
    MS-Off Ver
    O365 (PC) V 2406
    Posts
    44,662

    Re: Need a formula\function that return first and last value within range of numbers

    !!! I don't understand the logic here, at all. Can you explain how you arrive at your expected answers?

  5. #5
    Registered User
    Join Date
    11-13-2020
    Location
    Israel
    MS-Off Ver
    office 2016
    Posts
    7

    Re: Need a formula\function that return first and last value within range of numbers

    I'll try to explain.
    Maybe "range" is not the right word.

    I have values in one cell: "A1, A2, A3, A4, A5"

    I wish to get (return) the "from" and the "to" values.
    "From" value will be: A1.
    "To" value will be: A5.
    There are 5 values (Qty) from A1 to A5.

    Now if I have a single value like L8 with no follows values before and after it in the cell then the
    "From" and the "To" values will be both L8 (From L8 to L8)

  6. #6
    Forum Moderator Glenn Kennedy's Avatar
    Join Date
    07-08-2012
    Location
    Digital Nomad... occasionally based in Ireland.
    MS-Off Ver
    O365 (PC) V 2406
    Posts
    44,662

    Re: Need a formula\function that return first and last value within range of numbers

    This might require VBA.

    Clearly the text can be of variable length (A and XB were given as examples). Correct?

    Are the numerics at the end always 1 digit?

    Can there be numerics in the text portion, eg. XyZ23GGG1, XyZ23GGG2, XyZ23GGG3

    Do the numerics always go 1,2,3, etc,?

    Please answer carefully AND supply fully representative samples.

    Splitting them up is easy enough, but more information is neeeded about the strings themselves.
    Attached Files Attached Files
    Last edited by Glenn Kennedy; 11-14-2020 at 04:05 AM.

  7. #7
    Forum Guru Bo_Ry's Avatar
    Join Date
    09-10-2018
    Location
    Thailand
    MS-Off Ver
    MS 365
    Posts
    7,222

    Re: Need a formula\function that return first and last value within range of numbers

    Please try Power Query

    select A3 > Ribbon Data > from Table> advanced editor > paste below code

    Please Login or Register  to view this content.
    Attached Files Attached Files

  8. #8
    Registered User
    Join Date
    11-13-2020
    Location
    Israel
    MS-Off Ver
    office 2016
    Posts
    7

    Re: Need a formula\function that return first and last value within range of numbers

    Quote Originally Posted by Glenn Kennedy View Post
    This might require VBA.

    Clearly the text can be of variable length (A and XB were given as examples). Correct?

    Are the numerics at the end always 1 digit?

    Can there be numerics in the text portion, eg. XyZ23GGG1, XyZ23GGG2, XyZ23GGG3

    Do the numerics always go 1,2,3, etc,?

    Please answer carefully AND supply fully representative samples.

    Splitting them up is easy enough, but more information is neeeded about the strings themselves.
    The text can be of variable length up to 3 letters.
    The numerics at the end can be up to 4 digits.

    Can there be numerics in the text portion? NO.
    Only up to 3 letters at start and up to 4 digits at the end.

    Do the numerics always go 1,2,3, etc,? NO.
    The numerics can start from any number except for 0.

    Please let me know if more info is required.
    Is Bo_Ry's way should do the job?

+ 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. formula or function to return a string of numbers based on a counter
    By llomax83 in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 04-10-2017, 09:09 PM
  2. how to return numbers with highest value in the range
    By tantcu in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 10-07-2015, 09:23 PM
  3. [SOLVED] Formula to lookup a range of numbers and then return data in next 2 columns
    By justmeok in forum Excel Formulas & Functions
    Replies: 11
    Last Post: 05-15-2013, 11:54 PM
  4. [SOLVED] Need a formula that will return the 6 most common numbers in a range
    By caldinafan in forum Excel Formulas & Functions
    Replies: 5
    Last Post: 01-29-2013, 09:20 PM
  5. [SOLVED] If value is between a range of numbers, return value X
    By Oberst Hajj in forum Excel General
    Replies: 9
    Last Post: 07-15-2012, 06:17 AM
  6. [SOLVED] Vlookup formula - return only numbers for cells containing text and numbers
    By Andrew E Smith in forum Excel General
    Replies: 11
    Last Post: 07-03-2012, 06:07 AM
  7. inputbox to return row numbers in range
    By tryer in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 07-12-2009, 07:52 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