+ Reply to Thread
Results 1 to 7 of 7

Required formula to extract every occurrence of a sting from a column.

  1. #1
    Forum Contributor
    Join Date
    11-22-2020
    Location
    Sydney Australia
    MS-Off Ver
    365
    Posts
    202

    Required formula to extract every occurrence of a sting from a column.

    Hi All,

    I have a spreadsheet that pastes a lot of information for a singular horse race in one column.
    There can be up to 24 horses in a race, which means the column of data can easily reach 1500 cells.
    When the data is pasted, the horse name is immediately followed by the allocated weight in the cell underneath the name cell in every instance.
    However, where this data is pasted to does vary with every race. So I can not simply hard code a cell reference.
    I need to extract the horse name and allocated weight into an adjacent summary column.

    I could do this via VBA by testing every cell and then writing out the results, but I would prefer to be able to do it as formula(s) on the spreadsheet itself.

    Please see the attached sheet for sample data.

    I sincerely appreciate any assistance.

    Thanks in advance.
    Attached Files Attached Files

  2. #2
    Forum Contributor
    Join Date
    05-03-2021
    Location
    Nashville
    MS-Off Ver
    MS Office 365
    Posts
    184

    Re: Required formula to extract every occurrence of a sting from a column.

    I am not immediately seeing rhyme or reason behind the pasted data.

    though it looks like what you want to do is possible at first glance.

    Questions
    1) Is the horse name ALWAYS followed by a "Number" + decimal (eg: 1. , 2. , 3. , etc) (this can extract the horse name if no other cells have a number + decimal at the start of the cell.

    2) Is the weight ALWAYS formatted right below the Name of the Horse? and is it always formatted in W: xx.xx"kgF" (this can extract the weight.).

    Several helper rows can get these extracted then a simple if statement / rank based on number/row would get the format of the "Required Extracted Data"

  3. #3
    Forum Expert
    Join Date
    05-05-2015
    Location
    UK
    MS-Off Ver
    Microsoft Excel for Microsoft 365 MSO (Version 2402 Build 16.0.17328.20068) 64-bit
    Posts
    28,364

    Re: Required formula to extract every occurrence of a sting from a column.

    In E4

    =IFERROR(INDEX($A$2:$A$1000,AGGREGATE(15,6,1/(LEFT($A$2:$A$1000,3)="W: ")*ROW($A$1:$A$1000)-1,ROWS($1:1))),"")

    in F4

    =IFERROR(INDEX(MID($A$2:$A$1000,4,4),AGGREGATE(15,6,1/(LEFT($A$2:$A$1000,3)="W: ")*ROW($A$1:$A$1000),ROWS($1:1))),"")
    Attached Files Attached Files

  4. #4
    Forum Guru
    Join Date
    09-10-2017
    Location
    Chippenham, England
    MS-Off Ver
    365
    Posts
    15,120

    Re: Required formula to extract every occurrence of a sting from a column.

    Another option
    Formula: copy to clipboard
    Please Login or Register  to view this content.
    and
    Formula: copy to clipboard
    Please Login or Register  to view this content.

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

    Re: Required formula to extract every occurrence of a sting from a column.

    Please try

    =LET(a,FILTER(A4:A1500,(LEFT(A5:A1501,2)="W:")+(LEFT(A4:A1500,2)="W:")),IF(LEFT(a)="w",--MID(a,4,4),a))
    Attached Files Attached Files

  6. #6
    Forum Contributor
    Join Date
    05-03-2021
    Location
    Nashville
    MS-Off Ver
    MS Office 365
    Posts
    184

    Re: Required formula to extract every occurrence of a sting from a column.

    Late to the show.

    Assuming my questions were yes.

    I used helper columns and keeps the format to what you requested in a single column.

    At any rate.

    You have many different ways to get what you.
    Attached Files Attached Files

  7. #7
    Forum Contributor
    Join Date
    11-22-2020
    Location
    Sydney Australia
    MS-Off Ver
    365
    Posts
    202

    Re: Required formula to extract every occurrence of a sting from a column.

    Hi all,

    wow, what a great response. Thank you all for being so fast.

    I am excited to try these solutions tomorrow. Will let you know how it all goes.

    But for now, and pre-testing the results, I will mark this thread as solved

    Regards.

    Jeff

+ 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] Formula Required to Extract data from Column A based on Non -zero values in Column B
    By Ramzan-ul-Mubarak in forum Excel Formulas & Functions
    Replies: 7
    Last Post: 11-29-2019, 06:07 AM
  2. Extract required information from a column using VBA
    By Imran/CVT in forum Excel Programming / VBA / Macros
    Replies: 24
    Last Post: 09-07-2019, 10:31 AM
  3. [SOLVED] Formula to get row # for last occurrence of certain text in a column
    By rizmomin in forum Excel Formulas & Functions
    Replies: 6
    Last Post: 07-08-2018, 04:48 PM
  4. Replies: 17
    Last Post: 06-01-2018, 09:04 PM
  5. [SOLVED] Extract number from sting of text
    By L.LEE in forum Excel General
    Replies: 8
    Last Post: 04-01-2018, 10:11 AM
  6. [SOLVED] data extract sting
    By jiggaboi in forum Excel Formulas & Functions
    Replies: 4
    Last Post: 08-04-2013, 03:15 PM
  7. Macro to update a column value if it matches a sting in other column
    By salma2009 in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 07-28-2009, 10:42 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