+ Reply to Thread
Results 1 to 5 of 5

LEFT RIGHT MID complex problem

  1. #1
    Registered User
    Join Date
    04-16-2013
    Location
    London
    MS-Off Ver
    Excel 2007
    Posts
    3

    Unhappy LEFT RIGHT MID complex problem

    Hi,

    I am having some problems pulling out what I need from the data below. The number(s) before the apostrophe is the pack size, e.g. 10'S, 30'S etc. and I need to extract this number to a new column so then I can do a multiplication on it.

    I can't use text to columns as I have around 40k rows of data and the number of letters and spaces before the pack size changes all the time, so I would have to manually go and realign all the data.

    I've tried a lot of things using left, right and mid but can't get it to work. It seems excel can't count backwards if I use a mid and find the apostrophe then try to return -2 numbers before it.

    Thanks in advance!

    Product Pack size
    ABCD OAD CAPS 120 MG 10'S FGHI 10
    ABCD OAD CAPS 120 MG 30'S 30
    ABCD OAD CAPS 120 MG 30'S FGHI 30
    ABCD OAD CAPS 200 MG 10'S etc.
    ABCD OAD CAPS 200 MG 10'S FGHI

  2. #2
    Forum Expert Olly's Avatar
    Join Date
    09-10-2013
    Location
    Darlington, UK
    MS-Off Ver
    Excel 2016, 2019, 365
    Posts
    6,284

    Re: LEFT RIGHT MID complex problem

    Try:

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


    Of course this will only work if the number required is always 2 digits...
    let Source = #table({"Question","Thread", "User"},{{"Answered","Mark Solved", "Add Reputation"}}) in Source

    If I give you Power Query (Get & Transform Data) code, and you don't know what to do with it, then CLICK HERE

    Walking the tightrope between genius and eejit...

  3. #3
    Registered User
    Join Date
    04-16-2013
    Location
    London
    MS-Off Ver
    Excel 2007
    Posts
    3

    Re: LEFT RIGHT MID complex problem

    Thanks Olly. Unfortunately the number is sometimes 1 digit, sometimes, 2, sometimes 3.

    Any ideas?

  4. #4
    Registered User
    Join Date
    04-16-2013
    Location
    London
    MS-Off Ver
    Excel 2007
    Posts
    3

    Re: LEFT RIGHT MID complex problem

    Ha! got it!

    =IF(VALUE(MID(E500,FIND("'",E500)-2,2))>0,VALUE(MID(E500,FIND("'",E500)-2,2)),VALUE(MID(E500,FIND("'",E500)-3,3)))

    Thanks for the inspiration

  5. #5
    Forum Expert Olly's Avatar
    Join Date
    09-10-2013
    Location
    Darlington, UK
    MS-Off Ver
    Excel 2016, 2019, 365
    Posts
    6,284

    Re: LEFT RIGHT MID complex problem

    Or you could use a small user-defined-function:

    Please Login or Register  to view this content.
    Then use as:

    Formula: copy to clipboard
    Please Login or Register  to view this content.
    where your text is in cell A1...

+ 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. A rather complex problem!
    By tom041098 in forum Excel Formulas & Functions
    Replies: 5
    Last Post: 04-03-2013, 10:42 AM
  2. Complex averaging problem
    By Iamkar33m in forum Excel Programming / VBA / Macros
    Replies: 9
    Last Post: 12-14-2006, 01:07 PM
  3. [SOLVED] Complex Problem!!! MAYBE
    By maddog in forum Excel General
    Replies: 3
    Last Post: 05-04-2006, 08:10 AM
  4. [SOLVED] COMPLEX PROBLEM
    By elephant in forum Excel General
    Replies: 2
    Last Post: 04-03-2006, 10:25 AM
  5. Complex Problem
    By Jedispiff in forum Excel Formulas & Functions
    Replies: 4
    Last Post: 03-03-2006, 02:44 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