+ Reply to Thread
Results 1 to 4 of 4

Compare tow alphanumeric numbers and return a value

  1. #1
    Registered User
    Join Date
    02-01-2013
    Location
    United States
    MS-Off Ver
    Excel 2007
    Posts
    2

    Compare tow alphanumeric numbers and return a value

    New to VBA and Macros so I apologize if this is trivial...(also I apologize if I am not clear)

    I have two worksheets titled "Electrical Bid Items" and "2011 Weighted Average Bit Price". All items are numbered in the following format (701.1234('x') with 'x' being either a capital letter or a number.

    "Electrical Bid Items" contains a complete list of items that pertain to me. This list contains items not in the "2011 Weighted Average Bit Price" list.

    Ex...(all in Column A)
    701.12345
    701.1234A
    701.12346
    701.4566Z


    "2011 Weighted Average Bit Price" contains many entries I am not interested in and that are not included in the "Electrical Bid Items" list as well. This List however contains recent prices for its items.

    Ex...(all in Column A)
    701.12342
    701.1234A
    701.12346
    701.1244B
    701.4566Z


    What I would like to accomplish is a script that selects each item in the "Electrical Bid Items" list compares the items alphanumeric number to every entry in "2011 Weighted Average Bit Price" list until it finds a match and then return the related price of that item.

    So far I have been able to create the script below, however, it will ignore any entry with a letter. It does successfully compare the number only items and returns their value.


    Please Login or Register  to view this content.

    I have tried several different way of accomplishing all of this but the above is my most recent iteration...not sure if the best though.

    Thanks For any help and let me know if more information is needed.

  2. #2
    Forum Expert p24leclerc's Avatar
    Join Date
    07-05-2010
    Location
    Québec
    MS-Off Ver
    Excel 2021
    Posts
    2,081

    Re: Compare tow alphanumeric numbers and return a value

    looks like you could use Vlookup function. Have you tried it?
    Pierre Leclerc
    _______________________________________________________

    If you like the help you got,
    Click on the STAR "Add reputation" icon at the bottom.

  3. #3
    Registered User
    Join Date
    02-01-2013
    Location
    United States
    MS-Off Ver
    Excel 2007
    Posts
    2

    Re: Compare tow alphanumeric numbers and return a value

    Well I have now...but all I succeeded in doing is making myself more confused.

  4. #4
    Administrator FDibbins's Avatar
    Join Date
    12-29-2011
    Location
    Duncansville, PA USA
    MS-Off Ver
    Excel 7/10/13/16/365 (PC ver 2310)
    Posts
    52,926

    Re: Compare tow alphanumeric numbers and return a value

    If all you want to do is return the (exact) matching value from 1 list, try tisng this, copied down. I may have the references the wrong way round, if so, swap them

    =IFERROR(VLOOKUP(A1,'Electrical Bid Items'!$A$1:$A$4,1,FALSE),"")
    1. Use code tags for VBA. [code] Your Code [/code] (or use the # button)
    2. If your question is resolved, mark it SOLVED using the thread tools
    3. Click on the star if you think someone helped you

    Regards
    Ford

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

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