+ Reply to Thread
Results 1 to 3 of 3

Extract Multi-line data and date comparison

  1. #1
    Registered User
    Join Date
    12-02-2011
    Location
    india
    MS-Off Ver
    Excel 2010
    Posts
    73

    Extract Multi-line data and date comparison

    I have a situation wherein one cell contains multi-line text and dates and I need oldest date data and Latest data parsed in new columns.
    Like following:-

    Xusiaas SDI; EFFD=2018-01-16
    Xusiaas DY; EFFD=2018-01-16
    Xusiaas NICS; EFFD=2016-12-19
    Xusiaas NS; EFFD=2016-12-19

    the format for same is TEXT [semicolon] TEXT [equal Sign] [Date]

    Now i wish to have only TEXT data before [semicolon] but cache here is:-
    1. multiline text is to be parsed by comparing dates. So if two multiline dates are matching they are parsed together. multiline text can be one or many.
    2. There can be situation that their are many dates in that case we only choose latest and oldest date data.
    3. if only one date is present both Latest and Oldest column cell should be same.

    I have attached a file with sample data and followed by example of VBA output.
    can anyone please help me to get it solved?
    regards
    monika
    Attached Files Attached Files
    Last edited by chilli16; 05-23-2018 at 11:13 PM.

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

    Cool Hi ! Try this !


    A demonstration as a starter :

    PHP Code: 
    Sub Demo1()
        
    Dim R&, VD$(1), S$(1)
            
    Application.ScreenUpdating False
        
    For 2 To ActiveSheet.UsedRange.Rows.Count
            
    For Each V In Split(Replace(Cells(R1).ValuevbCr""), vbLf)
                     
    Split(V";")
                  
    V(1) = Split(V(1), "=")(1)
                If 
    V(1) > D(0Then
                    D
    (0) = V(1)
                    
    S(0) = V(0)
                ElseIf 
    V(1) = D(0Then
                    S
    (0) = S(0) & vbLf V(0)
                
    End If
                If 
    V(1) < D(1) Or D(1) = "" Then
                    D
    (1) = V(1)
                    
    S(1) = V(0)
                ElseIf 
    V(1) = D(1Then
                    S
    (1) = S(1) & vbLf V(0)
                
    End If
            
    Next
                Cells
    (R2).Resize(, 2).Value S
                Erase D
    S
        Next
            Application
    .ScreenUpdating True
    End Sub 
    Do you like it ? So thanks to click on bottom left star icon « Add Reputation » !

  3. #3
    Registered User
    Join Date
    12-02-2011
    Location
    india
    MS-Off Ver
    Excel 2010
    Posts
    73

    Re: Hi ! Try this !

    Absolutely Perfect and works like a charm.

    but little query can we have loop for either of new columns when, generated cell is empty text written in say COLUMN HEADER => product ... respective cell content is copied.

    many thanks for above vba solution

+ 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] Extract Multi-line Data Based on Form input
    By chilli16 in forum Excel Programming / VBA / Macros
    Replies: 16
    Last Post: 07-30-2018, 12:07 PM
  2. Data Comparison - Multi criteria
    By rickgarcia76 in forum Excel Formulas & Functions
    Replies: 8
    Last Post: 07-08-2015, 05:24 PM
  3. Replies: 2
    Last Post: 01-27-2013, 09:04 PM
  4. Extract Date from each line from wrapped text
    By Keerthivasan in forum Excel General
    Replies: 2
    Last Post: 07-21-2011, 06:45 AM
  5. Migrate multi line data from one sheet to another
    By softspoke in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 05-27-2008, 05:23 PM
  6. Parsing cell data with multi-line cells
    By nbn22385 in forum Excel Formulas & Functions
    Replies: 5
    Last Post: 11-06-2007, 05:35 AM
  7. Replies: 3
    Last Post: 06-07-2005, 09:05 AM

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