+ Reply to Thread
Results 1 to 5 of 5

Text To Columns and Calculation Macro

  1. #1
    Registered User
    Join Date
    03-17-2015
    Location
    London
    MS-Off Ver
    2013
    Posts
    51

    Unhappy Text To Columns and Calculation Macro

    Hello Guys,

    I am working on a class project and I think I've confused myself. I was hoping you could help me.

    I need a macro that splits alphabets after the file number and calculates the number of files generated.

    All file numbers are start with "QLHR" followed by 6 numbers (QLHR000000)
    Eg: QLHR049217

    However, if a file is replicated the system adds "A", if its replicated again it goes to "B", if its replicated again it goes to "C" and so on.

    File Count:
    No Number: 1
    A: 2
    B: 3
    C: 4
    D: 5
    E: 6

    and so on until Z

    I have attached sample of what I am working on. (it has a macro in there, It's gone horribly wrong).
    tab 1 is the data
    tab 2 is the output required.


    Please help me.
    Thanks for reading
    Tai
    Attached Files Attached Files

  2. #2
    Forum Expert daffodil11's Avatar
    Join Date
    07-11-2013
    Location
    Phoenixville, PA
    MS-Off Ver
    MS Office 2016
    Posts
    4,465

    Re: Text To Columns and Calculation Macro

    You could just use a formula:

    =IF(LEN(A2)=11,CODE(RIGHT(A2))-63,1)
    Make Mom proud: Add to my reputation if I helped out!

    Make the Moderators happy: Mark the Thread as Solved if your question was answered!

  3. #3
    Forum Expert daffodil11's Avatar
    Join Date
    07-11-2013
    Location
    Phoenixville, PA
    MS-Off Ver
    MS Office 2016
    Posts
    4,465

    Re: Text To Columns and Calculation Macro

    A VB version:
    Please Login or Register  to view this content.

  4. #4
    Registered User
    Join Date
    03-17-2015
    Location
    London
    MS-Off Ver
    2013
    Posts
    51

    Unhappy Re: Text To Columns and Calculation Macro

    Hi daffodil11,

    Thank you so much for your help. sorry for late reply I was having log in problems.

    The code works great! Thanks

    I am trying to Split the letter "K" from column C (cells named "EstimateUnits") to cells E and letter "k" from column D (cells named "ActualUnits") to cell F. Below is the code I have made. However, it keeps giving me an error.

    Can you help please?
    **File attached**
    FileCount.xlsm

    Please Login or Register  to view this content.
    Thanks
    Tai

  5. #5
    Forum Expert daffodil11's Avatar
    Join Date
    07-11-2013
    Location
    Phoenixville, PA
    MS-Off Ver
    MS Office 2016
    Posts
    4,465

    Re: Text To Columns and Calculation Macro

    It looks good to me.

    Add this to the beginning:
    Please Login or Register  to view this content.
    And this to the end:
    Please Login or Register  to view this content.
    which will get around the "you have stuff in the cells already" errors.

+ 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. How to perform calculation for multiple columns and rounding off using macro
    By raja15feb in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 10-16-2014, 04:03 AM
  2. Macro to search multiple (static) columns and perform calculation on adjacent cells
    By DubaiExcel in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 09-15-2013, 04:37 AM
  3. MAcro to - copy, transpose, text to columns, remove column A, combine all columns in 1
    By galvinpaddy in forum Excel Programming / VBA / Macros
    Replies: 17
    Last Post: 02-07-2013, 08:48 AM
  4. Macro for Text to Columns
    By sandz23 in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 04-21-2010, 02:59 PM
  5. [SOLVED] Macro to import text file and update calculation to include new co
    By Admirera in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 05-24-2006, 05:15 PM
  6. Percentage calculation on text columns
    By Connor in forum Excel General
    Replies: 3
    Last Post: 10-10-2005, 12:05 PM
  7. Macro for Text to Columns - convert to text or general
    By goofy11 in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 05-15-2005, 11: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