+ Reply to Thread
Results 1 to 4 of 4

LEFT() + RIGHT() + IF() not working in conjunction

  1. #1
    Registered User
    Join Date
    09-16-2021
    Location
    Ireland
    MS-Off Ver
    Office professional plus 16
    Posts
    2

    LEFT() + RIGHT() + IF() not working in conjunction

    Hi All,

    Only fresh to this forum.

    I'm trying to have my excel read the digits of a cell, and if it is between a certain value it is to produce a calculation, if not, its to produce a different calculation.

    I want to be able to put in two dimensions (mm x mm) and it will calculate the value based on this. The maximum dimension I want it to calculate at is 800mm, and the cell will only take values like 600x500; 700x200; 900x800
    (I will worry about a LEN() input after I actually get this part working first)
    eg of the formula
    A1: 700x600
    =IF(AND(LEFT(A1,3)<800,RIGHT(A1,3)<800), "Good", "Bad")

    So what should happen is that the Formula breaks out the first three digits of cell A1, and checks if its less than 800, it also checks the final three digits of cell A1, and checks if its less than 800. If they are less, it shows "good", and shows "bad" if it's false.

    At the moment I can't even get it to correctly output the Good or Bad text when I change the A1 cell to any other 7 character long value [it's spitting out "Bad" in this case, even though its obvious to see that both 700 & 600 is less than 800]
    Why is this? I had thought maybe it is outputting the LEFT() & RIGHT() as text and it cant figure out if its less than the value, but I can do other calculations with it so I don't know what the issue is. I have checked and I have auto-calculate on
    Can anyone figure it out?

    Any help would be much appreciated

  2. #2
    Forum Expert
    Join Date
    05-05-2015
    Location
    UK
    MS-Off Ver
    Microsoft Excel for Microsoft 365 MSO (Version 2402 Build 16.0.17328.20068) 64-bit
    Posts
    30,673

    Re: LEFT() + RIGHT() + IF() not working in conjunction

    Try

    =IF(AND(LEFT(A1,3)*1<800,RIGHT(A1,3)*1<800), "Good", "Bad")

    Convert LEFT/RIGHT TEXT to NUMBER as your comparisons are vs numeric values
    Last edited by JohnTopley; 09-16-2021 at 01:54 PM.

  3. #3
    Registered User
    Join Date
    09-16-2021
    Location
    Ireland
    MS-Off Ver
    Office professional plus 16
    Posts
    2

    Re: LEFT() + RIGHT() + IF() not working in conjunction

    Thanks John, the *1 worked!
    Don't know how I didn't think of it - I was even trying ABS() haha

  4. #4
    Forum Expert
    Join Date
    05-05-2015
    Location
    UK
    MS-Off Ver
    Microsoft Excel for Microsoft 365 MSO (Version 2402 Build 16.0.17328.20068) 64-bit
    Posts
    30,673

    Re: LEFT() + RIGHT() + IF() not working in conjunction

    If that takes care of your original question, please select Thread Tools from the menu link above and mark this thread as SOLVED.
    Last edited by JohnTopley; 09-16-2021 at 03:32 PM.

+ 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] If statement on Left(string) not working
    By ABBOV in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 06-24-2019, 08:27 AM
  2. IF(), AND(), and LEFT() are not working together
    By gracej in forum Excel Formulas & Functions
    Replies: 6
    Last Post: 10-08-2017, 12:47 PM
  3. If left statement not working
    By snsman in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 12-22-2015, 07:46 AM
  4. Index, Match, If, and Combo Box Working in Conjunction??
    By childs71 in forum Excel Formulas & Functions
    Replies: 0
    Last Post: 09-03-2015, 09:01 AM
  5. Index, Match, If, and Combo Box Working in Conjunction??
    By childs71 in forum Excel Formulas & Functions
    Replies: 0
    Last Post: 09-03-2015, 08:14 AM
  6. Left-aligning certain cells not working??
    By WorldBuilder in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 10-15-2012, 11:39 AM
  7. [SOLVED] Sort Left to Right not working
    By Juan in forum Excel General
    Replies: 3
    Last Post: 07-29-2005, 03:05 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