+ Reply to Thread
Results 1 to 11 of 11

Conditional Proper Case

  1. #1
    Banned User!
    Join Date
    03-06-2014
    Location
    USA
    MS-Off Ver
    2010
    Posts
    295

    Conditional Proper Case

    I have this sample data in Excel and would like to know if it could be edited to proper case with conditions. The part numbers need to remain upper case but the words should be proper case. The first column is before and the second is the result I would like. I have about 20K records so it would be nice to automate the process.

    Does anyone know of a way to accomplish this? Thank you

    [Code]
    99999 TRUNNION ASSEMBLY 99999 Trunnion Assembly
    99999 SENDING UNIT 99999 Sending Unit
    CE2150H13YY25 CE2150H13YY25
    CE2151H15YY15 CE2151H15YY15

    [Code]

    I tried to paste the table but the data shifted sorry.

  2. #2
    Forum Expert
    Join Date
    09-20-2011
    Location
    England
    MS-Off Ver
    Excel 2010
    Posts
    2,278

    Re: Conditional Proper Case

    Hello
    If your data syntax is consistent, as in your four examples, and your Code of numbers is always followed by a space and the cells with the Codes alone have no space then a macro or formula could convert them. For example this macro:

    Please Login or Register  to view this content.
    The code would go through A1:A20 and place the converted string in the adjacent cell. If all is well you could then paste them in to your actual data field. You could of course overwrite the data directly but probably isn't a good idea in case it's not correct as VBA nullifies the Undo option.

    Another alternative would be a helper column with formulas to do the same thing.

    Formula: copy to clipboard
    Please Login or Register  to view this content.


    Everything does depend on the consistency of your original data layout.

    Hope this helps.
    DBY
    Last edited by DBY; 03-02-2016 at 01:14 PM.

  3. #3
    Banned User!
    Join Date
    03-06-2014
    Location
    USA
    MS-Off Ver
    2010
    Posts
    295

    Re: Conditional Proper Case

    Sorry I should have pasted more examples of the data.

    52D267M
    1C970-982-9999
    1CC258
    9B56B5698BNM
    VENDOR PART 2568KKP
    OSCILLOSCOPE TEK 475BVX


    I guess where ever there is a word it should be proper case. Does that help? I really appreciate any assistance. I will make a backup copy before doing any changes in case it doesn't turn out correctly.

  4. #4
    Valued Forum Contributor
    Join Date
    01-03-2016
    Location
    Conwy, Wales
    MS-Off Ver
    2016
    Posts
    974

    Re: Conditional Proper Case

    You have provided very little sample data, but

    If non Part Numbers always commence with 99999 then try this formula in cell B2 and copy down (assumes records are in column A starting at A2)

    =IF(LEFT(A2,5)="99999",PROPER(A2),UPPER(A2))

    I also notice that everything is duplicated with a space in the centre. If this is consistent then this may help. If the above works, then put this formula in cell C2 and copy down.
    It removes trailing and leading spaces etc and that should leave an odd number of character because of central blank space. It leaves the left half of the cell adjusting for that extra character.


    =LEFT(TRIM(B2),(LEN(TRIM(B2))-1)/2)

    And if you then want to eliminate the 99999, put this formula in cell D2 and copy down
    (removes first 6 characters of the cell)

    =IF(LEFT(C2,5) = "99999",RIGHT(C2,LEN(C2)-6),C2)


    EDIT
    This post looks irrelevant looking at post#3
    Last edited by Kevin#; 03-02-2016 at 01:46 PM. Reason: May be superceded

  5. #5
    Banned User!
    Join Date
    03-06-2014
    Location
    USA
    MS-Off Ver
    2010
    Posts
    295

    Re: Conditional Proper Case

    Sorry for the confusion. I wanted to post the file itself but there are over 20K records. I will attempt to make the edits with what was provided thus far thank you.

  6. #6
    Forum Expert
    Join Date
    09-20-2011
    Location
    England
    MS-Off Ver
    Excel 2010
    Posts
    2,278

    Re: Conditional Proper Case

    Yes it's tricky with the layout. There's not really any way I know of telling Excel what constitutes a legitimate word and what is a code number as the codes are often text strings. You could perhaps break the strings apart at the spaces convert them to proper case and then concatenate them again. If I think of a way I'll add another post.

  7. #7
    Valued Forum Contributor
    Join Date
    01-03-2016
    Location
    Conwy, Wales
    MS-Off Ver
    2016
    Posts
    974

    Re: Conditional Proper Case

    How about posting a cut-down version of the file - say the first 500 lines

  8. #8
    Banned User!
    Join Date
    03-06-2014
    Location
    USA
    MS-Off Ver
    2010
    Posts
    295

    Re: Conditional Proper Case

    Okay I will do that give me a few minutes please.

  9. #9
    Banned User!
    Join Date
    03-06-2014
    Location
    USA
    MS-Off Ver
    2010
    Posts
    295

    Re: Conditional Proper Case

    I am trying to add the file but it won't let me do it. Any ideas why? It is a macro enabled file does that matter?

  10. #10
    Forum Expert shg's Avatar
    Join Date
    06-20-2007
    Location
    The Great State of Texas
    MS-Off Ver
    2003, 2010
    Posts
    40,678

    Re: Conditional Proper Case

    Entia non sunt multiplicanda sine necessitate

  11. #11
    Banned User!
    Join Date
    03-06-2014
    Location
    USA
    MS-Off Ver
    2010
    Posts
    295

    Re: Conditional Proper Case

    Hey thanks for the fantastic support.

+ 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. Upper Case or Proper Case help
    By Excelnoub in forum Excel Programming / VBA / Macros
    Replies: 11
    Last Post: 05-24-2013, 02:56 PM
  2. [SOLVED] Need the proper syntax to use Case/Select Case in vba properly.
    By rbion in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 05-16-2013, 02:34 PM
  3. [SOLVED] Proper Case using VBA
    By HangMan in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 01-22-2013, 10:50 AM
  4. Replies: 3
    Last Post: 10-30-2009, 04:00 PM
  5. proper case
    By stevekirk in forum Excel General
    Replies: 2
    Last Post: 02-26-2007, 06:47 AM
  6. excel'03 how to convert a column from upper case to proper case
    By sharie palmer in forum Excel General
    Replies: 1
    Last Post: 01-30-2006, 07:55 PM
  7. [SOLVED] Excel: How do I change all upper case ss to proper case?
    By Moosieb in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 01-12-2006, 08:50 PM
  8. [SOLVED] Changing Upper case to Proper Case
    By Mountain in forum Excel Formulas & Functions
    Replies: 1
    Last Post: 01-13-2005, 07:06 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