+ Reply to Thread
Results 1 to 7 of 7

Long IF statement--gives formula parse error

  1. #1
    Registered User
    Join Date
    05-14-2014
    MS-Off Ver
    Excel 2016
    Posts
    14

    Long IF statement--gives formula parse error

    I am trying to evaluate text in a cell. I have 132 combinations that I am evaluating for. Each combination represents a different number. When it finds the matching combination, I want the number that corresponds to be put in the cell. I typed in this long IF statement and it gives me a formula parse error. What am I doing wrong?

    One additional thing to add...the cell I am evaluating...I have used the CONCATENATE function to create the text I am evaluating.

    =if(e2="VRWHJ",3.2,if(e2="VRSHE",2.0,if(e2="VRSSE",2.3,if(e2="VRCONK",3.2,if(e2="VRBIS",2.3,if(e2="VRCJH",.3,if(e2="VRGRC",1.4,if(e2="VRPS",1.5,if(e2="VRCO",2.7,if(e2="VRATC",.2,if(e2="VRBG",2.7,if(e2="WHJVR",3.2,if(e2="WHJSHE",1.4,if(e2="WHJSSE",4.4,if(e2="WHJCONK",.1,if(e2="WHJBIS",4.4,if(e2="WHJCJH",3.0,if(e2="WHJGRC",4.6,if(e2="WHJPS",2.6,if(e2="WHJCO",3.8,if(e2="WHJATC",3.5,if(e2="WHJBG",3.8,if(e2="SHEVR",2.0,if(e2="SHEWHJ",1.4,if(e2="SHESSE",3.2,if(e2="SHECONK",1.4,if(e2="SHEBIS",3.2,if(e2="SHECJH",1.7,if(e2="SHEGRC",3.3,if(e2="SHEPS",1.3,if(e2="SHECO",2.7,if(e2="SHEATC",2.2,if(e2="SHEBG",2.7,if(e2="SSEVR",2.3,if(e2="SSEWHJ",4.4,if(e2="SSESHE",3.2,if(e2="SSECONK",3.8,if(e2="SSEBIS",.1,if(e2="SSECJH",2.6,if(e2="SSEGRC",3.4,if(e2="SSEPS",2.7,if(e2="SSECO",.6,if(e2="SSEATC",2.5,if(e2="SSEBG",.6,if(e2="CONKVR",3.2,if(e2="CONKWHJ",.1,if(e2="CONKSHE",1.4,if(e2="CONKSSE",3.8,if(e2="CONKBIS",4.4,if(e2="CONKCJH",3.0,if(e2="CONKGRC",4.6,if(e2="CONKPS",2.6,if(e2="CONKCO",3.8,if(e2="CONKATC",3.4,if(e2="CONKBG",3.8,if(e2="BISVR",2.3,if(e2="BISWHJ",4.4,if(e2="BISSHE",3.2,if(e2="BISSSE",.1,if(e2="BISCONK",4.4,if(e2="BISCJH",2.6,if(e2="BISGRC",3.4,if(e2="BISPS",2.7,if(e2="BISCO",.6,if(e2="BISATC",2.5,if(e2="BISBG",.6,if(e2="CJHVR",.3,if(e2="CJHWHJ",3.0,if(e2="CJHSHE",1.7,if(e2="CJHSSE",2.6,if(e2="CJHCONK",3.0,if(e2="CJHBIS",4.4,if(e2="CJHGRC",1.6,if(e2="CJHPS",1.3,if(e2="CJHCO",3.0,if(e2="CJHATC",.2,if(e2="CJHBG",3.0,if(e2="GRCVR",1.4,if(e2="GRCWHJ",4.6,if(e2="GRCSHE",3.3,if(e2="GRCSSE",3.4,if(e2="GRCCONK",4.6,if(e2="GRCBIS",3.4,if(e2="GRCCJH",1.6,if(e2="GRCPS",2.9,if(e2="GRCCO",3.9,if(e2="GRCATC",1.6,if(e2="GRCBG",3.9,if(e2="PSVR",1.5,if(e2="PSWHJ",2.6,if(e2="PSSHE",1.3,if(e2="PSSSE",2.7,if(e2="PSCONK",2.6,if(e2="PSBIS",2.7,if(e2="PSCJH",1.3,if(e2="PSGRC",2.9,if(e2="PSCO",3.0,if(e2="PSATC",1.4,if(e2="PSBG",3.0,if(e2="COVR",2.7,if(e2="COWHJ",3.8,if(e2="COSHE",2.7,if(e2="COSSE",.6,if(e2="COCONK",3.8,if(e2="COBIS",.6,if(e2="COCJH",3.0,if(e2="COGRC",3.9,if(e2="COPS",3.0,if(e2="COATC",2.9,if(e2="COBG",.1,if(e2="ATCVR",.2,if(e2="ATCWHJ",3.5,if(e2="ATCSHE",2.2,if(e2="ATCSSE",2.5,if(e2="ATCCONK"3.4,if(e2="ATCBIS",2.5,if(e2="ATCCJH",.2,if(e2="ATCGRC",1.6,if(e2="ATCPS",1.4,if(e2="ATCCO",2.7,if(e2="ATCBG",2.7,if(e2="BGVR",2.7,if(e2="BGWHJ",3.8,if(e2="BGSHE",2.7,if(e2="BGSSE",.6,if(e2="BGCONK",3.8,if(e2="BGBIS",.6,if(e2="BGCJH",3.0,if(e2="BGGRC",3.9,if(e2="BGPS",3.0,if(e2="BGCO",.1,if(e2="BGATC"2.7))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))

    Thanks in advance for your answer.
    Last edited by turkeyman2000; 09-29-2014 at 04:26 PM.

  2. #2
    Forum Guru TMS's Avatar
    Join Date
    07-15-2010
    Location
    The Great City of Manchester, NW England ;-)
    MS-Off Ver
    MSO 2007,2010,365
    Posts
    44,419

    Re: Long IF statement--gives formula parse error

    If you are using 2003 you can only have, I think, 7 levels of nesting.

    Use a lookup table with VLOOKUP.

    Regards, TMS
    Trevor Shuttleworth - Retired Excel/VBA Consultant

    I dream of a better world where chickens can cross the road without having their motives questioned

    'Being unapologetic means never having to say you're sorry' John Cooper Clarke


  3. #3
    Forum Expert JBeaucaire's Avatar
    Join Date
    03-21-2004
    Location
    Bakersfield, CA
    MS-Off Ver
    2010, 2016, Office 365
    Posts
    33,492

    Re: Long IF statement--gives formula parse error

    1) Add a new sheet, let's name the sheet Lookup
    2) ON the new Lookup sheet create a two column Table. Column A is the string to find, column B is the result
    Please Login or Register  to view this content.
    3) Now, back on your original sheet, your formula can be replaced with a simple VLOOKUP():

    =VLOOKUP(E2, Lookup!$A:$B, 2, 0)
    _________________
    Microsoft MVP 2010 - Excel
    Visit: Jerry Beaucaire's Excel Files & Macros

    If you've been given good help, use the icon below to give reputation feedback, it is appreciated.
    Always put your code between code tags. [CODE] your code here [/CODE]

    ?None of us is as good as all of us? - Ray Kroc
    ?Actually, I *am* a rocket scientist.? - JB (little ones count!)

  4. #4
    Registered User
    Join Date
    05-14-2014
    MS-Off Ver
    Excel 2016
    Posts
    14

    Re: Long IF statement--gives formula parse error

    Thanks TMS and JBeaucaire! Much appreciated! I will try it. I am a beginner at this...so it may take me a few tries.

  5. #5
    Registered User
    Join Date
    05-14-2014
    MS-Off Ver
    Excel 2016
    Posts
    14

    Re: Long IF statement--gives formula parse error

    It worked! Thanks! Much appreciated!

  6. #6
    Forum Expert JBeaucaire's Avatar
    Join Date
    03-21-2004
    Location
    Bakersfield, CA
    MS-Off Ver
    2010, 2016, Office 365
    Posts
    33,492

    Re: Long IF statement--gives formula parse error

    As it appears you've reached a conclusion, I've marked this thread SOLVED for you.
    FYI, this is done through the Thread Tools located above the first post in this thread. Thanks.

  7. #7
    Forum Guru TMS's Avatar
    Join Date
    07-15-2010
    Location
    The Great City of Manchester, NW England ;-)
    MS-Off Ver
    MSO 2007,2010,365
    Posts
    44,419

    Re: Long IF statement--gives formula parse error

    Thanks for the rep, although JB did the work and made the concept into a reality for you.

    Regards, TMS

+ 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. IF Statement (I think) with long formula...
    By nkitchen31 in forum Excel Formulas & Functions
    Replies: 1
    Last Post: 12-19-2013, 06:21 AM
  2. Help improving formula; IF statement is too long.
    By cydonia in forum Excel Formulas & Functions
    Replies: 19
    Last Post: 01-04-2010, 07:50 PM
  3. [SOLVED] Can't add 7th IF statement to long formula.
    By manxman in forum Excel Formulas & Functions
    Replies: 7
    Last Post: 06-08-2006, 09:20 AM
  4. [SOLVED] How parse out characters from long string?
    By Chet in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 01-23-2006, 06:10 PM
  5. [SOLVED] Parse a long string into lines?
    By quartz in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 01-10-2005, 06:06 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