+ Reply to Thread
Results 1 to 12 of 12

Formula in macro dont work with mixed number and letters

  1. #1
    Forum Contributor
    Join Date
    07-28-2012
    Location
    madrid
    MS-Off Ver
    Excel 2010 at work excel 2016
    Posts
    1,102

    Formula in macro dont work with mixed number and letters

    HI Below code compare the value in part of column P with the actual value in column H. If any difference it mark in column H.
    It works fine when all is numbers. But in some cases it can be mixed and here it give the wrong result.

    In the test sheet all ís matching according to the formula in the code. But it mark H12 to H15 yellow, because I think there is mixed letters and numbers.
    The formula check from digit 15 and 11 digit with the mid function and then it add up to 12 digets with leading zeroes.

    Here below is the code. and there is also a test sheet to check with.

    Please have a look

    Sincerely
    Abjac

    Please Login or Register  to view this content.
    Attached Files Attached Files

  2. #2
    Forum Expert
    Join Date
    04-22-2013
    Location
    .
    MS-Off Ver
    .
    Posts
    4,418

    Re: Formula in macro dont work with mixed number and letters

    Try something like:

    Please Login or Register  to view this content.

  3. #3
    Forum Contributor
    Join Date
    07-28-2012
    Location
    madrid
    MS-Off Ver
    Excel 2010 at work excel 2016
    Posts
    1,102

    Re: Formula in macro dont work with mixed number and letters

    Wow ragulduy it works really great and much better for me to use in fact. One question. Can I use this in also right formulas and how will that look.

    Thanks

    Abjac

  4. #4
    Forum Expert
    Join Date
    04-22-2013
    Location
    .
    MS-Off Ver
    .
    Posts
    4,418

    Re: Formula in macro dont work with mixed number and letters

    Sorry, I'm not sure I can understand the question..

    You could use a conditional format like:
    =H9<>"0"&MID(P9,15,11)
    to highlight column H as necessary?

  5. #5
    Forum Contributor
    Join Date
    07-28-2012
    Location
    madrid
    MS-Off Ver
    Excel 2010 at work excel 2016
    Posts
    1,102

    Re: Formula in macro dont work with mixed number and letters

    I mean if I wanted to make this code like urs. Its right function in the formula.
    Sub inputupdated20()
    This one would check the same way but in column I and for the last 2 digits in column P

    Please Login or Register  to view this content.

  6. #6
    Forum Expert
    Join Date
    04-22-2013
    Location
    .
    MS-Off Ver
    .
    Posts
    4,418

    Re: Formula in macro dont work with mixed number and letters

    Oh ok, yes the equivalent would be:

    Please Login or Register  to view this content.

  7. #7
    Forum Contributor
    Join Date
    07-28-2012
    Location
    madrid
    MS-Off Ver
    Excel 2010 at work excel 2016
    Posts
    1,102

    Re: Formula in macro dont work with mixed number and letters

    That's why I asked if you put this in the test sheet it will mark all yellow. It will check the last 2 digits and if any difference it have to be yellow. But here it mark all in column I. Don't understand why its like that. Try check this in the test sheet for column I.

    Thanks in advance

    Abjac

  8. #8
    Forum Contributor
    Join Date
    07-28-2012
    Location
    madrid
    MS-Off Ver
    Excel 2010 at work excel 2016
    Posts
    1,102

    Re: Formula in macro dont work with mixed number and letters

    If I put this one in for column F it does the same mark all yellow. Don't understand why its working only for column H.
    This is the code for column F . Abjac

    Please Login or Register  to view this content.

  9. #9
    Forum Expert
    Join Date
    04-22-2013
    Location
    .
    MS-Off Ver
    .
    Posts
    4,418

    Re: Formula in macro dont work with mixed number and letters

    Sorry, I forgot to remove the "0" & which isn't necessary for the other columns:

    Please Login or Register  to view this content.

  10. #10
    Forum Contributor
    Join Date
    07-28-2012
    Location
    madrid
    MS-Off Ver
    Excel 2010 at work excel 2016
    Posts
    1,102

    Re: Formula in macro dont work with mixed number and letters

    It was working fine and I though I knew the system so I added the last column but in column G it again mark all cells. There is leading zeroes in this column,, My code was like this..
    Cant see again why its not working. Have a look and try below code.
    Its with all the columns I need to check.
    Abjac
    Please Login or Register  to view this content.

  11. #11
    Forum Expert
    Join Date
    04-22-2013
    Location
    .
    MS-Off Ver
    .
    Posts
    4,418

    Re: Formula in macro dont work with mixed number and letters

    Try:

    Please Login or Register  to view this content.

  12. #12
    Forum Contributor
    Join Date
    07-28-2012
    Location
    madrid
    MS-Off Ver
    Excel 2010 at work excel 2016
    Posts
    1,102

    Re: Formula in macro dont work with mixed number and letters

    Hi This is working for sure fine now. Just hard to understand the total logic in it. But its working brilliant.

    Thanks for you patience, great help.

    Have a nice evening

    Abjac

+ 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] Formula to only return a number value in a column with mixed Alpha and Numeric values
    By AusVivienne in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 12-05-2012, 03:17 AM
  2. Replies: 0
    Last Post: 01-30-2012, 07:54 PM
  3. Counting numberical values mixed with letters: Yes, Yes+1, Yes+2, etc.
    By KatherineMolina in forum Excel Formulas & Functions
    Replies: 4
    Last Post: 01-16-2008, 02:49 PM
  4. Beginner Quest: Macro's dont' work after changing the file name
    By acc58 in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 12-19-2006, 09:52 AM
  5. Sort mixed numbers/letters
    By V-ger in forum Excel General
    Replies: 1
    Last Post: 11-14-2005, 06:55 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