+ Reply to Thread
Results 1 to 12 of 12

Alpha numeric with max 3 digit numbers based on criteria

  1. #1
    Forum Contributor
    Join Date
    11-12-2012
    Location
    Jeddah, Saudi Arabia
    MS-Off Ver
    2010, 2013, 2016, Office 365
    Posts
    507

    Alpha numeric with max 3 digit numbers based on criteria

    hi,

    I need to convert the target cell value with Alpha numeric based on multiple cell criteria. Following is the criteria

    If Column A consists of Value "Float" and Column B consists value ("ABC") then convert target cell (Column C) with Alpha numeric.

    Example,

    If I enter value "1" in column C, then target cell value should be FDTJ-001

    I have more than 14 criteria in Column B. I have attached the workbook with some samples.

    Regards,
    Attached Files Attached Files

  2. #2
    Forum Moderator AliGW's Avatar
    Join Date
    08-10-2013
    Location
    Retired in Ipswich, Suffolk, but grew up in Sawley, Derbyshire (England)
    MS-Off Ver
    MS 365 Subscription Insider Beta Channel v. 2404 (Windows 11 22H2 64-bit)
    Posts
    80,859

    Re: Alpha numeric with max 3 digit numbers based on criteria

    What if column A contains something else?
    Ali


    Enthusiastic self-taught user of MS Excel who's always learning!
    Don't forget to say "thank you" in your thread to anyone who has offered you help.
    You can reward them by clicking on * Add Reputation below their user name on the left, if you wish.

    Forum Rules (updated August 2023): please read them here.

  3. #3
    Forum Contributor
    Join Date
    11-12-2012
    Location
    Jeddah, Saudi Arabia
    MS-Off Ver
    2010, 2013, 2016, Office 365
    Posts
    507

    Re: Alpha numeric with max 3 digit numbers based on criteria

    If Column A contains something else, then exit sub

  4. #4
    Forum Expert
    Join Date
    12-10-2006
    Location
    Sydney
    MS-Off Ver
    Office 365
    Posts
    3,525

    Re: Alpha numeric with max 3 digit numbers based on criteria

    Hi Barieq,

    Does it have to be a macro? Have a look at the attached which is all done via formulas.

    Thanks,

    Robert
    Attached Files Attached Files
    ____________________________________________
    Please ensure you mark your thread as Solved once it is. Click here to see how
    If this post helps, please don't forget to say thanks by clicking the star icon in the bottom left-hand corner of my post

  5. #5
    Forum Contributor
    Join Date
    11-12-2012
    Location
    Jeddah, Saudi Arabia
    MS-Off Ver
    2010, 2013, 2016, Office 365
    Posts
    507

    Re: Alpha numeric with max 3 digit numbers based on criteria

    Thanks, but I prefer a sheet event code. When I enter any number from 1 to 999 in target cell, it should convert to the desired format in the same cell based on the criteria. It does not limit to only one number.

  6. #6
    Forum Expert
    Join Date
    12-10-2006
    Location
    Sydney
    MS-Off Ver
    Office 365
    Posts
    3,525

    Re: Alpha numeric with max 3 digit numbers based on criteria

    OK so keeping with my idea to have a lookup table on Sheet2, try this event macro on Sheet1:

    Please Login or Register  to view this content.
    Regards,

    Robert

  7. #7
    Forum Contributor
    Join Date
    11-12-2012
    Location
    Jeddah, Saudi Arabia
    MS-Off Ver
    2010, 2013, 2016, Office 365
    Posts
    507

    Re: Alpha numeric with max 3 digit numbers based on criteria

    Thanks, Is there any possibility to limit the number up to 3 digits only.

  8. #8
    Forum Contributor
    Join Date
    11-12-2012
    Location
    Jeddah, Saudi Arabia
    MS-Off Ver
    2010, 2013, 2016, Office 365
    Posts
    507

    Re: Alpha numeric with max 3 digit numbers based on criteria

    Dear Robert,

    Your code does not change the Alphabet, it is giving the same text to whatever number I enter.

  9. #9
    Forum Expert
    Join Date
    11-24-2013
    Location
    Paris, France
    MS-Off Ver
    Excel 2003 / 2010
    Posts
    9,831

    Cool Hi ! Try this ‼


    As an easy starter :

    PHP Code: 
    Private Sub Worksheet_Change(ByVal Target As Range)
        If 
    Target.Column And IsNumeric(Target.ValueThen
            
    If Target(1, -1).Value "Float" Then
                Select 
    Case Target(10).Value
                       
    Case "ABC":  """FDFT-""000"
                       
    Case "DEF":  """FDAJ-""000"
                       
    Case "DHI":  """FDDJ-""000"
                       
    Case "XYZ":  """FDRJ-""000"
                
    End Select
                
    If "" Then
                    Application
    .EnableEvents False
                    Target
    .Value Format(Target.ValueV)
                    
    Application.EnableEvents True
                End 
    If
            
    End If
        
    End If
    End Sub 
    Do you like it ? So thanks to click on bottom left star icon « Add Reputation » !

  10. #10
    Forum Contributor
    Join Date
    11-12-2012
    Location
    Jeddah, Saudi Arabia
    MS-Off Ver
    2010, 2013, 2016, Office 365
    Posts
    507

    Re: Alpha numeric with max 3 digit numbers based on criteria

    Thanks, this is exactly what I wanted. This the best and simple solution. Now I mark this thread as Solved.

  11. #11
    Forum Expert
    Join Date
    11-24-2013
    Location
    Paris, France
    MS-Off Ver
    Excel 2003 / 2010
    Posts
    9,831

    Re: Alpha numeric with max 3 digit numbers based on criteria


    Thanks for the rep' !

  12. #12
    Forum Expert
    Join Date
    12-10-2006
    Location
    Sydney
    MS-Off Ver
    Office 365
    Posts
    3,525

    Re: Alpha numeric with max 3 digit numbers based on criteria

    Though I see Marc L has provided you with a nifty solution, here's mine revamped:

    Please Login or Register  to view this content.
    Thanks also for the rep

    Regards,

    Robert
    Last edited by Trebor76; 04-23-2018 at 07:26 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. Replies: 20
    Last Post: 09-27-2019, 10:11 AM
  2. [SOLVED] Return 2 digit numeral from either side of - in an alpha numeric string
    By UnitedCloud01 in forum Excel General
    Replies: 3
    Last Post: 08-10-2017, 11:41 PM
  3. Replies: 6
    Last Post: 05-19-2017, 05:34 PM
  4. [SOLVED] Return latest Alpha / Numeric / Numeric Alpha Revision
    By cthompson30 in forum Excel Formulas & Functions
    Replies: 11
    Last Post: 05-16-2017, 10:31 AM
  5. [SOLVED] macro to extract 9 digit numbers as well as alpha numberic 9 digit numbers from txt file
    By Raju Radhakrishnan in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 04-13-2012, 10:15 AM
  6. sorting alpha numeric list by first left digit
    By kaduna in forum Excel - New Users/Basics
    Replies: 6
    Last Post: 01-13-2006, 07:15 PM
  7. [SOLVED] Extract Numbers from Alpha-Numeric String
    By MrBill in forum Excel Formulas & Functions
    Replies: 1
    Last Post: 11-02-2005, 06:17 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