+ Reply to Thread
Results 1 to 8 of 8

Using MID function and got wrong results in some cells

  1. #1
    Registered User
    Join Date
    11-03-2020
    Location
    Sibiu
    MS-Off Ver
    Microsoft Office 630
    Posts
    3

    Using MID function and got wrong results in some cells

    Hello,
    My name is Valentina and I need some help with MID function in excel. I am not an expert at excel, but I am trying to learn as much as possible and use the functions correctly.
    I used the MID function in a column with 11 cells, the problem is that 3 cells from 11 has returned incomplete data or extra data. Those cells has wrong data.
    Can you tell me why the others extracted the data that I needed (the correct data) and those 3 hasn't? I will upload the excel sheet with my issue and you can see there the function that I used and the errors from those cells - (I colored those with red so you can see exactly what I am talking about).
    Thank you in advance for your help and looking forward for a solution.
    Attached Files Attached Files

  2. #2
    Forum Expert etaf's Avatar
    Join Date
    10-22-2004
    Location
    Wittering, West Sussex, UK
    MS-Off Ver
    365 (Mac OSX) (16.84 (24041420))
    Posts
    8,750

    Re: Using MID function and got wrong results in some cells

    the length changes and you are using the length - find x which should be
    =MID(B2,FIND("M",B2),FIND("x",B2)-FIND("M",B2))
    where X is from the Start of the string NOT the end of the string
    As you are looking for the difference in characters between the M and the x
    NOT the X position based on the length of the string

    You can see why its 3 characters in the columns i have broken the formula down
    I always break the parts out into separate cells if things don't appear to be working correctly
    Attached Files Attached Files
    Last edited by etaf; 11-03-2020 at 03:37 AM.
    Wayne
    if my assistance has helped, and only if you wish to , there is an "* Add Reputation" on the left hand side - you can add to my reputation here

    If you have a solution to your thread - Please mark your thread solved do the following: >
    Select Thread Tools-> Mark thread as Solved. To undo, select Thread Tools-> Mark thread as Unsolved.

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

    Re: Using MID function and got wrong results in some cells

    Another way:

    C2
    =LEFT(MID(B2,SEARCH(" ",B2)+1,255),SEARCH("x",MID(B2,SEARCH(" ",B2)+1,255))-1)

    D2
    =--RIGHT(B2,LEN(B2)-FIND("x",B2))

    E2:
    =INDEX(Sheet2!$C$2:$C$61,INDEX(MATCH(1,(Sheet2!$A$2:$A$61=C2)*(Sheet2!$B$2:$B$61=D2),0),0))

    Since you're in Romania, you may need ; instead of ,
    Attached Files Attached Files
    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.

    Temporary addition of accented to illustrate ongoing problem to the TT: L? fh?ile P?draig sona dhaoibh

  4. #4
    Registered User
    Join Date
    11-03-2020
    Location
    Sibiu
    MS-Off Ver
    Microsoft Office 630
    Posts
    3

    Re: Using MID function and got wrong results in some cells

    Thank you so much for your help!

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

    Re: Using MID function and got wrong results in some cells

    You're welcome.



    If that takes care of your original question, please select "Thread Tools" from the menu link above and mark this thread as SOLVED.

    It'd also be appreciated if you were to click the Add Reputation button at the foot of any of the posts of all members who helped you reach a solution.

  6. #6
    Forum Expert bebo021999's Avatar
    Join Date
    07-22-2011
    Location
    Vietnam
    MS-Off Ver
    Excel 2016
    Posts
    9,466

    Re: Using MID function and got wrong results in some cells

    Alternative:
    =TRIM(MID(SUBSTITUTE(SUBSTITUTE(B2,"M",REPT(" ",100)&"M"),"x",REPT(" ",100)),100,100))
    =IFERROR(RIGHT(B2,3)+0,RIGHT(B2,2)+0)
    Quang PT

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

    Re: Using MID function and got wrong results in some cells

    I think you will run into problems....

    If there is an M or an X, or an extra space in the brand Name

    Magnetix Skrue M8x120

    may cause problems. If so, post REPRESENTATIVE raw data.

  8. #8
    Registered User
    Join Date
    11-03-2020
    Location
    Sibiu
    MS-Off Ver
    Microsoft Office 630
    Posts
    3

    Re: Using MID function and got wrong results in some cells

    Hi again,
    I have exactly the problems you said., but now it's different because of Torx in the data - "Unb.skr. Torx M5x8" it doesn't select M5 or 8.

+ 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. LOOKUP function gives me the wrong results in my table
    By ukguyuk in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 01-16-2018, 01:14 PM
  2. [SOLVED] FREQUENCY function returns wrong results
    By imatzav in forum Excel Formulas & Functions
    Replies: 11
    Last Post: 07-30-2017, 05:47 AM
  3. [SOLVED] Interquartile range function giving wrong results
    By gko_87 in forum Excel Formulas & Functions
    Replies: 4
    Last Post: 06-04-2017, 12:21 PM
  4. [SOLVED] Getting wrong results for frequency function and countif functions
    By KurtBliss in forum Excel Formulas & Functions
    Replies: 5
    Last Post: 08-13-2015, 06:39 PM
  5. Retrieving results and FORECAST function - the results are wrong!
    By Lucky_G in forum Excel Formulas & Functions
    Replies: 8
    Last Post: 10-03-2014, 10:57 AM
  6. [SOLVED] Wrong function results
    By madsteeve in forum Excel - New Users/Basics
    Replies: 8
    Last Post: 04-19-2013, 10:14 AM
  7. [SOLVED] Some wrong IF Function results
    By CTMAC in forum Excel Formulas & Functions
    Replies: 7
    Last Post: 03-16-2013, 12:41 PM

Tags for this Thread

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