+ Reply to Thread
Results 1 to 5 of 5

if first 4 numbers match in sorted list, find last in series

  1. #1
    Registered User
    Join Date
    02-27-2012
    Location
    atlanta
    MS-Off Ver
    Excel 2007
    Posts
    61

    Talking if first 4 numbers match in sorted list, find last in series

    Hi, column A is a sorted numeric list. IF the first 4 characters match, identify in helper column B which is the last in the series by adding "Last" to the row.
    I need to ultimately find root numbers only (1014, 1017, 1020, etc and not the child numbers 1014-1, 1014-2, etc). I figured I could identify the last one and sort again to remove the rest.
    Help please?

    column A column B
    sku last in series
    1014-1
    1014-2
    1014-3
    1014-4
    1014-5 last
    1017-1
    1017-2
    1017-20
    1017-21 last
    1020-1
    1020-2
    1020-3
    1020-4
    1020-5 last

  2. #2
    Forum Guru Pete_UK's Avatar
    Join Date
    12-31-2011
    Location
    Warrington, England
    MS-Off Ver
    Office 2019 (still learning)
    Posts
    24,814

    Re: if first 4 numbers match in sorted list, find last in series

    Try this in B2:

    =IF(COUNTIF(A$2:A2,LEFT(A2,4)&"*")=COUNTIF(A:A,LEFT(A2,4)&"*"),"Last","")

    then copy down to the bottom of your data.

    You will need to fix the values in column B before sorting, as a different sort order will change the values that the formula produces.

    Hope this helps.

    Pete

  3. #3
    Forum Moderator AliGW's Avatar
    Join Date
    08-10-2013
    Location
    Retired in Ipswich, Suffolk, but grew up in Sawley, Derbyshire (England)
    MS-Off Ver
    MS 365 Subscription Insider Beta Channel v. 2405 (Windows 11 23H2 64-bit)
    Posts
    81,442

    Re: if first 4 numbers match in sorted list, find last in series

    Try this copied down:

    =IF(LEFT(A2,4)<>LEFT(A3,4),"Last","")
    Ali


    Enthusiastic self-taught user of MS Excel who's always learning!
    Don't forget to say "thank you" in your thread to anyone who has offered you help.
    You can reward them by clicking on * Add Reputation below their user name on the left, if you wish.

    Forum Rules (updated August 2023): please read them here.

  4. #4
    Registered User
    Join Date
    02-27-2012
    Location
    atlanta
    MS-Off Ver
    Excel 2007
    Posts
    61

    Re: if first 4 numbers match in sorted list, find last in series

    Yay! Both work! Appreciate it very much!

  5. #5
    Forum Moderator AliGW's Avatar
    Join Date
    08-10-2013
    Location
    Retired in Ipswich, Suffolk, but grew up in Sawley, Derbyshire (England)
    MS-Off Ver
    MS 365 Subscription Insider Beta Channel v. 2405 (Windows 11 23H2 64-bit)
    Posts
    81,442

    Re: if first 4 numbers match in sorted list, find last in series

    You’re welcome!

+ 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. [SOLVED] Rearranging a sorted list of numbers
    By northerngator in forum Excel General
    Replies: 2
    Last Post: 11-11-2015, 05:02 PM
  2. [SOLVED] Extract a non-sorted list with blank cells into a sorted list
    By RJK in forum Excel Formulas & Functions
    Replies: 7
    Last Post: 05-08-2015, 12:41 AM
  3. Find a cell adress between a list of sorted values
    By Odracir in forum Excel Formulas & Functions
    Replies: 10
    Last Post: 03-05-2015, 05:42 PM
  4. [SOLVED] Creating a sorted list, using INDEX, MATCH, LARGE, COUNTIF
    By amnesiac77 in forum Excel General
    Replies: 7
    Last Post: 07-25-2014, 10:56 AM
  5. [SOLVED] Trying to find multiple ID numbers which match a particular name from a list.
    By thevolv in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 04-09-2014, 06:45 PM
  6. Replies: 4
    Last Post: 07-06-2013, 04:44 PM
  7. Chart Series Formats lost when list re -sorted
    By Fullam in forum Excel General
    Replies: 1
    Last Post: 06-06-2006, 05:50 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