+ Reply to Thread
Results 1 to 7 of 7

If statement with "Left"

Hybrid View

ammartino44 If statement with... 10-15-2013, 01:42 PM
Ace_XL Re: If statement with... 10-15-2013, 01:43 PM
daddylonglegs Re: If statement with... 10-15-2013, 01:49 PM
ammartino44 Re: If statement with... 10-15-2013, 02:23 PM
{=OR(value=array)} Re: If statement with... 10-15-2013, 02:37 PM
ammartino44 Re: If statement with... 10-15-2013, 02:41 PM
Tony Valko Re: If statement with... 10-15-2013, 02:41 PM
  1. #1
    Forum Contributor
    Join Date
    08-14-2013
    Location
    LA Baby!!
    MS-Off Ver
    Excel 2007
    Posts
    1,598

    If statement with "Left"

    Hello. How would I do an if statement to say, If the 8th character is a letter, return true, if it is a number return false?

    123456 Harvard

    My attempt: If(Left(Cell,8)=.....

    Thanks

  2. #2
    Forum Expert Ace_XL's Avatar
    Join Date
    06-04-2012
    Location
    UAE
    MS-Off Ver
    2016
    Posts
    6,074

    Re: If statement with "Left"

    Try

    =NOT(ISNUMBER(MID(A1,8,1)*1))

    EDIT: MID will always return TEXT hence ISTEXT will not work
    Last edited by Ace_XL; 10-15-2013 at 01:47 PM.
    Life's a spreadsheet, Excel!
    Say thanks, Click *

  3. #3
    Forum Expert daddylonglegs's Avatar
    Join Date
    01-14-2006
    Location
    England
    MS-Off Ver
    Microsoft 365
    Posts
    14,697

    Re: If statement with "Left"

    Quote Originally Posted by Ace_XL View Post
    =NOT(ISNUMBER(MID(A1,8,1)*1))
    ...or you could save a function call and use this:

    =ISERROR(MID(A1,8,1)+0)
    Audere est facere

  4. #4
    Forum Contributor
    Join Date
    08-14-2013
    Location
    LA Baby!!
    MS-Off Ver
    Excel 2007
    Posts
    1,598

    Re: If statement with "Left"

    Great. Thanks. Both of these worked. But I tried to put it in conditional formatting and it didn't work. Why is this?

    Edit: Also, what should I do if there is a blank cell. I would like these cells to return False.

    Thanks

  5. #5
    Registered User
    Join Date
    10-14-2013
    Location
    Saturn
    MS-Off Ver
    Excel 2010
    Posts
    28

    Re: If statement with "Left"

    Quote Originally Posted by ammartino44 View Post
    great. Thanks. Both of these worked. But i tried to put it in conditional formatting and it didn't work. Why is this?

    Edit: Also, what should i do if there is a blank cell. I would like these cells to return false.

    Thanks
    =if(a1="",false,iserror(mid(a1,8,1)+0))

  6. #6
    Forum Contributor
    Join Date
    08-14-2013
    Location
    LA Baby!!
    MS-Off Ver
    Excel 2007
    Posts
    1,598

    Re: If statement with "Left"

    Actually this formula worked =NOT(ISNUMBER(MID(A1,8,1)*1)), the other one didn't. Now I just need to figure out how to ignore empty cells because those cells return false (and then true because of the NOT).

    Edit: I tried putting in $A40="" to format the blanks a particular way but it doesn't work right. After I press enter it returns this ="$A40="""""
    Last edited by ammartino44; 10-15-2013 at 02:45 PM.

  7. #7
    Forum Expert Tony Valko's Avatar
    Join Date
    12-31-2011
    Location
    Pittsburgh
    MS-Off Ver
    2002, 2007:2013
    Posts
    18,890

    Re: If statement with "Left"

    What if the 8th character is a space or a punctuation mark (if that's even possible)?

    Here's something that's a bit more robust.

    =AND(LEN(A2)>=8,ISERR(-MID(A2,8,1)))
    Last edited by Tony Valko; 10-15-2013 at 02:48 PM.
    Biff
    Microsoft MVP Excel
    Keep It Simple Stupid

    Let's Go Pens. We Want The Cup.

+ 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] Expanded and collapsed the rows by toggle "+" or "-" sign on left of the text
    By Rocky2013 in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 08-24-2013, 02:49 PM
  2. Applying a "Left" formula to an entire column with heading "ValueCol"
    By aad401 in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 07-12-2012, 04:14 PM
  3. If statement with "left" condition applied to a date
    By Portuga in forum Excel General
    Replies: 3
    Last Post: 03-11-2008, 07:03 PM
  4. Replies: 3
    Last Post: 12-14-2006, 01:36 PM
  5. Replies: 5
    Last Post: 06-26-2006, 09:23 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