+ Reply to Thread
Results 1 to 7 of 7

trying to check for either of two conditions in a cell

  1. #1
    Forum Contributor
    Join Date
    09-15-2012
    Location
    Jamaica
    MS-Off Ver
    Microsoft 365
    Posts
    244

    trying to check for either of two conditions in a cell

    I am trying to do one of two execution in a cell. The first is if cell length is = 17 then cell = h7; however if cell length = 9 then add a zero to cell h8 and copy the first to characters from a8 to h8. So if a8 = 123456789 then a zero to h8 and copy the first two chracters. so the result for this example would be: h8 = 012. below is the code i have but it just wont execute the expected result (note: i am learning so go a bit easy ok).

    Please Login or Register  to view this content.
    Thanks for assisting.

  2. #2
    Forum Contributor
    Join Date
    03-15-2012
    Location
    Myrtle Beach, South Carolina
    MS-Off Ver
    =IF(Win 7,"Excel 2010","Mac Excel 2011")
    Posts
    104

    Re: trying to check for either of two conditions in a cell

    what is your hf?

  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: trying to check for either of two conditions in a cell

    Based on your verbal description:

    =IF(LEN(A8)=17, H7, IF(LEN(A8)=9, "0"&LEFT(A8,2), ""))
    Last edited by JBeaucaire; 10-08-2012 at 05:37 PM.
    _________________
    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
    Valued Forum Contributor
    Join Date
    05-08-2012
    Location
    Georgia, USA
    MS-Off Ver
    Excel 2003, 2010
    Posts
    811

    Re: trying to check for either of two conditions in a cell

    =if(len(a8)=17,h7,if(len(a8)=9,"0"&left(a8,2),""))
    Click on star (*) below if this helps

  5. #5
    Forum Contributor
    Join Date
    09-15-2012
    Location
    Jamaica
    MS-Off Ver
    Microsoft 365
    Posts
    244

    Re: trying to check for either of two conditions in a cell

    Quote Originally Posted by jakeisbill View Post
    what is your hf?
    HF has a default code that i want the cell to populate if the length is = 17. An example of what would be in HF is: 035

  6. #6
    Forum Contributor
    Join Date
    09-15-2012
    Location
    Jamaica
    MS-Off Ver
    Microsoft 365
    Posts
    244

    Re: trying to check for either of two conditions in a cell

    Thank you "K m" for your prompt yet accurate response. Wow you guys make make things seem easier than they appear.

    I am from Jamaica so I will give my usual Jamaican Thank you!

    Km yu a di Bhass (boss pronounced with a a), bless up!


    Quote Originally Posted by K m View Post
    =if(len(a8)=17,h7,if(len(a8)=9,"0"&left(a8,2),""))

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

    Re: trying to check for either of two conditions in a cell

    I have marked this thread solved for you.
    In the future please select Thread Tools from the menu above and mark the thread as solved. Thanks.

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

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