+ Reply to Thread
Results 1 to 4 of 4

Using Mid and If function together

  1. #1
    Registered User
    Join Date
    02-16-2015
    Location
    California
    MS-Off Ver
    Excel for Mac 2011 V 14.4.7
    Posts
    31

    Using Mid and If function together

    I'm trying to use a MID & IF function together, but it's not quite working.

    In column J, I have a set of project numbers where the 2nd character of that project number indicates the year. In the destination column, I want to return the four digit year of that project number.

    PROJECT #----------------YEAR

    W63BT015141B-----------2016
    F53BT015141C------------2015

    The possible years would go back to 2010.

    The function I'm trying to use is as follows, but I'm getting a return of "FALSE."

    =IF(MID(J16,2,1)=6,2016,IF(MID(J16,2,1)=5,2015,IF(MID(J16,2,1)=4,2014,IF(MID(J16,2,1)=3,2013,IF(MID(J16,2,1)=2,2012,IF(MID(J16,2,1)=1,2011,IF(MID(J16,2,1)=0,2010)))))))

    Furthermore, we have some project numbers which are unique in that they don't indicate a year but rather a alpha character, so I would have to manually check those instances. How can I indicate in my formula that if the 2nd digit doesn't contain a number value, return the word "Check" to indicate the need to manually check that instance?

    Thanks!!

  2. #2
    Forum Guru
    Join Date
    08-05-2004
    Location
    NJ
    MS-Off Ver
    365
    Posts
    13,582

    Re: Using Mid and If function together

    =IFERROR((201&MID(J16,2,1))+0, "Check")
    ChemistB
    My 2?

    substitute commas with semi-colons if your region settings requires
    Don't forget to mark threads as "Solved" (Edit First post>Advanced>Change Prefix)
    If I helped, Don't forget to add to my reputation (click on the little star at bottom of this post)

    Forum Rules: How to use code tags, mark a thread solved, and keep yourself out of trouble

  3. #3
    Valued Forum Contributor Gatti's Avatar
    Join Date
    06-08-2015
    Location
    Brasil, São Paulo, Ribeirão Preto
    MS-Off Ver
    365
    Posts
    346

    Re: Using Mid and If function together

    The problem is you are trying to use a Text Function and find a Value...

    If you use MID(J16,2,1), the result will be "number" e.g.: J16 = 16, so the return of MID(J16,2,1) will be "6"... "6" is different then 6

    you have to put a VALUE() function before each MID function...

    By the way, use the @ChemistB's function... then you don't need to do all those "IF's"
    Last edited by Gatti; 01-21-2016 at 04:23 PM.

  4. #4
    Registered User
    Join Date
    02-16-2015
    Location
    California
    MS-Off Ver
    Excel for Mac 2011 V 14.4.7
    Posts
    31

    Re: Using Mid and If function together

    This worked beautifully, thank you!

+ 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. Calling function inside function. (aka nested function)
    By jakopak in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 11-02-2015, 05:58 AM
  2. VBA code for custom function that returns detail results of array function
    By onechipshot in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 10-10-2015, 06:30 PM
  3. Replies: 1
    Last Post: 06-10-2015, 12:56 PM
  4. Replies: 13
    Last Post: 04-08-2014, 05:46 AM
  5. index function error using match function to get data from a cell in an array
    By mabildgaard in forum Excel Formulas & Functions
    Replies: 4
    Last Post: 10-17-2013, 02:21 AM
  6. [SOLVED] IF Function referencing IsNumber, Match, Left function on separate sheets
    By Touch9713 in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 10-12-2013, 10:09 PM
  7. Replies: 1
    Last Post: 03-21-2012, 11:22 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