+ Reply to Thread
Results 1 to 11 of 11

Conversion of text files to Excel in consideration of criterion

  1. #1
    Registered User
    Join Date
    03-15-2017
    Location
    Mumbai
    MS-Off Ver
    2013
    Posts
    96

    Conversion of text files to Excel in consideration of criterion

    Dear Excel experts,
    We have 2 different text files
    Pasting as it is in a excel file (named data) in 2 different worksheets..
    1. (1) EAL_as it is
    2. (2) System_as it is
    From these 2 txt files, we converting these 2 different lists in same excel file (named data) in another s 2 different worksheets..
    3. (1) EAL_List
    4. (2) System_list
    Criteria :
    >> Conversion (text to column) of an excel file named (1) EAL_List from (1) EAL_as it is considering following…
    a. Data is starts from the row, where 1st three characters are CTR (because HDRADVANCEUSC ALB H00451 E is optional, not in all cases, hence data start either from 1st or 2nd row depends availability of CTR at first)
    b. List is to be commenced from the Container No. (length = 11) , which is at after CTR (length = 3) and space(length = 6) ; in this case 1st row in Container No. column it is GLDU5267198
    c. Next field is Weight (length = 5), which is at / immediate after Container No. ; in this case 1st row in Weight column it is 22.30.
    d. Next field is ISO (length = 4) which is at / immediate after Weight. ; in this case 1st row in ISO column it is 2210.
    e. Next field is Status (length = 1) which is at / immediate after ISO ; in this case 1st row in Status column it is F.
    f. Next field is IMO (length = 6) which is at / immediate after Status; in this case 1st row in IMO column it is Blank(NIL).
    g. Next field is POL (length = 3) which is at / immediate after IMO; in this case 1st row in POL column it is NSA.
    h. Next field is POD (length = 3) which is at / immediate after POL and space (length = 2) ; in this case 1st row in POD column it is JED.
    i. Next field is CAT (length = 1) which is at / immediate after POD; in this case 1st row in CAT column it is E.
    j. Next field is Mode (length = 1) which is at / immediate after CAT; in this case 1st row in Mode column it is T.
    k. Next field is Line (length = 3) which is at / immediate after Mode; in this case 1st row in Line column it is USC.
    l. Next field is Rfr Sts (length = 1) which is at / immediate after Line and space (length = 1); in this case 1st row in Rfr Sts column it is N.
    m. Last field is Temp (length = 6) which is at / immediate after Rfr Sts and space (length = 1); in this case 1st row in Temp column it is Blank (NIL).

    Conversion of an excel file named (2) System_list from (2) System_as it is considering following…
    In worksheet (2) System_as it is Search listed filds/column it is Equipment ID, Wgt-MTn,Type,Sts,IMO,POL,POD,Cat,Inbound Carrier, Line, Temp.


    Paste (special) it in worksheet (2) System_list Search listed fields and REPLACE...Equipment ID, Wgt-MTn,Type,Sts,IMO, POL, POD, Cat, Inbound Carrier, Line, Temp WITH Container No., Weight,ISO, Status, IMO, POL, POD, Cat, Mode, Line, Rfr Sts,Temp RESPECTIVELY

    Insert Rfr Sts in between Line and Temp column

    > Value in Rfr Sts column if Temp is Blank Rfr Sts will N ; Temp is Non-Blank Rfr Sts will Y
    > Value in Mode column if Mode is TRUCK it is to be replaced with T and remaining all are to be replaced with R

    Please help me in the same

    - Ravi
    Attached Files Attached Files

  2. #2
    Forum Expert Olly's Avatar
    Join Date
    09-10-2013
    Location
    Darlington, UK
    MS-Off Ver
    Excel 2016, 2019, 365
    Posts
    6,284

    Re: Conversion of text files to Excel in consideration of criterion

    Looks like this will be easiest with Power Query, to transform the text files (although, you should be able to query Navis in a better way than this!)

    Attach a couple of your original text files, and I'll write a power query script to transform them.
    let Source = #table({"Question","Thread", "User"},{{"Answered","Mark Solved", "Add Reputation"}}) in Source

    If I give you Power Query (Get & Transform Data) code, and you don't know what to do with it, then CLICK HERE

    Walking the tightrope between genius and eejit...

  3. #3
    Registered User
    Join Date
    03-15-2017
    Location
    Mumbai
    MS-Off Ver
    2013
    Posts
    96

    Re: Conversion of text files to Excel in consideration of criterion

    Please ref. to attached files
    Attached Files Attached Files

  4. #4
    Forum Expert Olly's Avatar
    Join Date
    09-10-2013
    Location
    Darlington, UK
    MS-Off Ver
    Excel 2016, 2019, 365
    Posts
    6,284

    Re: Conversion of text files to Excel in consideration of criterion

    It's quite simple to do the transformations using Power Query.

    This query will transform your EAL file:
    Please Login or Register  to view this content.
    This query will transform your SPARCS system file:
    Please Login or Register  to view this content.
    In both cases, just change the file path / name (in red) to suit.

    See attached workbook for worked example.

    Incidentally - are you at NSICT? It's a long time since I was there!
    Attached Files Attached Files

  5. #5
    Registered User
    Join Date
    03-15-2017
    Location
    Mumbai
    MS-Off Ver
    2013
    Posts
    96

    Re: Conversion of text files to Excel in consideration of criterion

    Dear Sir,

    As far as Power query is concerned, i am new, can you please explain in details where we want to paste above code/queries and further process,

    And i am not working with NSICT but in a container terminal

    - Ravi

  6. #6
    Forum Expert Olly's Avatar
    Join Date
    09-10-2013
    Location
    Darlington, UK
    MS-Off Ver
    Excel 2016, 2019, 365
    Posts
    6,284

    Re: Conversion of text files to Excel in consideration of criterion

    Enable the Power Query addin.

    Click POWER QUERY > Get External Data > From Other Sources > Blank Query

    In the Power Query editor window, click 'Advanced Editor' then paste the query code (changing filepath / name as required).

    Click 'Close & Load'.

    This page is worth a read: https://support.office.com/en-us/art...5-89F6269CD605


    I know you're at a container terminal, and I see you're in Mumbai, so I presumed you were in Nhava Sheva

  7. #7
    Registered User
    Join Date
    03-15-2017
    Location
    Mumbai
    MS-Off Ver
    2013
    Posts
    96

    Re: Conversion of text files to Excel in consideration of criterion

    Sir,
    I am unable to see Power Query addin, unable to find any setting for said add in
    Can it be done through macro/vba instead of power query; macro / vba will be more simple and user friendly than power query.

    Yes Sir, i am in Nhava Sheva.

    - Ravi

  8. #8
    Forum Expert Olly's Avatar
    Join Date
    09-10-2013
    Location
    Darlington, UK
    MS-Off Ver
    Excel 2016, 2019, 365
    Posts
    6,284

    Re: Conversion of text files to Excel in consideration of criterion

    This will show you how to add Power Query: https://www.excelcampus.com/install-power-query/

    Quote Originally Posted by Ravi_Kadu View Post
    Can it be done through macro/vba instead of power query;
    Yes, it can be done. I won't be doing it, though. Writing it in Power Query took less than 5 minutes, and gives the result you want.

    Quote Originally Posted by Ravi_Kadu View Post
    macro / vba will be more simple and user friendly than power query.
    No it won't. If you think that, then go right ahead and write the VBA...!

    The Power Query solution gives you a really simple interface, which is easy to follow, audit and change. Really. It's worth giving it a try. Install the addin, open the sample workbook I attached, look at the Power Query steps.

  9. #9
    Registered User
    Join Date
    03-15-2017
    Location
    Mumbai
    MS-Off Ver
    2013
    Posts
    96

    Re: Conversion of text files to Excel in consideration of criterion

    Can any one help me to resolve it. Thank you for your help in advance
    - Ravi

  10. #10
    Forum Expert Olly's Avatar
    Join Date
    09-10-2013
    Location
    Darlington, UK
    MS-Off Ver
    Excel 2016, 2019, 365
    Posts
    6,284

    Re: Conversion of text files to Excel in consideration of criterion

    Did you try using the Power Query solution?

  11. #11
    Registered User
    Join Date
    03-15-2017
    Location
    Mumbai
    MS-Off Ver
    2013
    Posts
    96

    Re: Conversion of text files to Excel in consideration of criterion

    As it require installation of addin in all the require PCs; in fact this is not possible for us, Excel template with macro script will be better.

+ 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] IMPORTING TEXT FILES TO EXCEL - Multiple Multi-line text files, each in a new column
    By wrenchfry in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 12-23-2014, 08:37 PM
  2. pasting consideration between word & excel
    By vientito in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 04-01-2014, 10:58 AM
  3. conversion of excel files to bat files
    By macedo in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 10-15-2013, 12:32 PM
  4. Replies: 16
    Last Post: 07-31-2010, 07:32 PM
  5. Conversion of text files without change in the original file
    By vinwin06 in forum Word Programming / VBA / Macros
    Replies: 3
    Last Post: 07-27-2010, 07:45 PM
  6. Replies: 2
    Last Post: 03-01-2010, 04:39 PM
  7. Limit macro conversion to only .txt files or delete existing .xls files
    By macro_noob in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 06-06-2008, 03:54 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