+ Reply to Thread
Results 1 to 9 of 9

Formula to find a word in middle of a cell

  1. #1
    Registered User
    Join Date
    04-28-2014
    Location
    Edinburgh
    MS-Off Ver
    Excel 2013
    Posts
    11

    Formula to find a word in middle of a cell

    Hi
    I’m hoping this isn’t wishful thinking.

    I have a long list of records all as text, and I need to extract part of the cell into a separate field. Each cell has a weight in it in ‘kg’ and I need to get the weight into a separate cell. I’ve always used the formula below to find what I’ve needed but I don’t know how to make it so that it basically finds the kg and then goes back as far as a space and returns everything from the space to (and including) the kg.

    =MID(E23,FIND("kg",E23)-2,6)

    Examples of how the weight is displayed in the records and they are not all in the same place.
    6kg
    14kg
    5.7kg
    12.4kg
    and so on
    Thanks in advance for your help.

  2. #2
    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. 2404 (Windows 11 22H2 64-bit)
    Posts
    80,647

    Re: Formula to find a word in middle of a cell

    You need to provide samples of the entire cell contents, please.
    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.

  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. 2404 (Windows 11 22H2 64-bit)
    Posts
    80,647

    Re: Formula to find a word in middle of a cell

    Having said that, this might work:

    =TRIM(RIGHT(SUBSTITUTE(MID(E23,FIND("kg",E23)-10,12)," ",REPT(" ",10)),15))

  4. #4
    Registered User
    Join Date
    04-28-2014
    Location
    Edinburgh
    MS-Off Ver
    Excel 2013
    Posts
    11

    Re: Formula to find a word in middle of a cell

    Hi thanks for the help

    this is examples of how the information is held


    food 11.4kg beef
    dry 2.27kg food
    large 18.25kg wet mix
    simple 6kg feed
    premium 11kg dry

  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. 2404 (Windows 11 22H2 64-bit)
    Posts
    80,647

    Re: Formula to find a word in middle of a cell

    See post #3.

  6. #6
    Registered User
    Join Date
    04-28-2014
    Location
    Edinburgh
    MS-Off Ver
    Excel 2013
    Posts
    11

    Re: Formula to find a word in middle of a cell

    Hi Ali
    Thanks where the weight is short it is also returning some of the letters prior to it

    total food 11.4kg beef 11.4kg
    Populardry 2.27kg food 2.27kg
    large 18.25kg wet mix 18.25kg
    Cheapsimple 6kg feed le 6kg
    premium 11kg dry m 11kg

  7. #7
    Registered User
    Join Date
    04-28-2014
    Location
    Edinburgh
    MS-Off Ver
    Excel 2013
    Posts
    11

    Re: Formula to find a word in middle of a cell

    Hi Ali

    Thank you so much the formula work perfectly.

  8. #8
    Forum Guru
    Join Date
    02-27-2016
    Location
    Vietnam
    MS-Off Ver
    2016
    Posts
    5,907

    Re: Formula to find a word in middle of a cell

    Or try:

    =LOOKUP(10^35,--MID(A1,FIND("kg",A1)-{1,2,3,4,5,6,7,8,9},{1,2,3,4,5,6,7,8,9}))

  9. #9
    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. 2404 (Windows 11 22H2 64-bit)
    Posts
    80,647

    Re: Formula to find a word in middle of a cell

    Try changing it to this:

    =TRIM(RIGHT(SUBSTITUTE(MID(E23,FIND("kg",E23)-10,12)," ",REPT(" ",10)),9))

+ 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] Puzzling - Extract the word with PH- in it, start, middle or end of cell location
    By vkingxl in forum Excel Formulas & Functions
    Replies: 7
    Last Post: 07-02-2018, 04:20 PM
  2. Formula to find certain word in cell
    By jw01 in forum Excel General
    Replies: 3
    Last Post: 04-13-2018, 02:25 PM
  3. [SOLVED] Formula to find a word in a cell and return what it says around it
    By Scottpet in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 04-13-2018, 09:15 AM
  4. [SOLVED] Formula to get the middle word
    By krazyhype19 in forum Excel Formulas & Functions
    Replies: 6
    Last Post: 03-28-2014, 04:49 AM
  5. Find word and insert formula in cell to right
    By ScabbyDog in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 04-10-2013, 01:33 AM
  6. [SOLVED] find date in middle of numbers and use it to calculate a cell value
    By CityInspector in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 10-26-2012, 11:16 AM
  7. [SOLVED] Copying a word from one cell in a different worksheet into the middle of a sentence.
    By DannyJ in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 09-25-2012, 11:18 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