Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8853861
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T13:45:04+00:00 2026-06-14T13:45:04+00:00

I have rows in excel with a file structure for example. Row 1 c:\User\Folder100\13-25\File100.log

  • 0

I have rows in excel with a file structure for example.

Row 1 c:\User\Folder100\13-25\File100.log
Row 2 c:\User\Folder200\11-16\File200.log
Row 3 c:\User\Folder300\21-20\File300.log
Row 4 c:\User\Folder400\13-25\File400.log
Row 5 c:\User\Folder400\9-10\File400.log
Row 6 c:\User\Folder500\8-16\File500.log
Row 7 c:\User\Folder600\8-16\File600.log
Row 8 c:\User\Folder700\11-16\File700.log
Row 9 c:\User\Folder700\9-40\File700.log

With the first rows there aren’t any problem because the file logs are different but with the rows (4 and 5) a There are the same log in two different folders “c:\User\Folder400\13-25\” and c:\User\Folder400\9-10\ I would like to keep just 13-25(eliminate Row 5) because has more recent time.

Also with the lines 8 and 9 I just want to keep row 8 (11-16)

Row 1 c:\User\Folder100\13-25\File100.log
Row 2 c:\User\Folder200\11-16\File200.log
Row 3 c:\User\Folder300\21-20\File300.log
Row 4 c:\User\Folder400\13-25\File400.log
Row 6 c:\User\Folder500\8-16\File500.log
Row 7 c:\User\Folder600\8-16\File600.log
Row 8 c:\User\Folder700\11-16\File700.log

(eliminated row 5 and 9)

Do you know any Idea how to made it in VBA¿?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-14T13:45:05+00:00Added an answer on June 14, 2026 at 1:45 pm

    This does not exactly serve the purpose, but serves to illustrate a way by which you could go about problems like this.

    It takes into account the filename and the time string preceding it only. The folder can be added if necessary.

    Main Module:

    Option Explicit
    Private dict As dictionary
    
    'Prints the rows you need (time criterion applied) 
    Private Sub FindDuplicates()
        Dim lastRow As Long, row As Long
        Dim x As Variant, v As Variant
        Dim fileName As String, timeString As String
    
        Set dict = CreateObject("Scripting.Dictionary")
    
        'Determine last row
        lastRow = Worksheets(1).Cells(Rows.Count, 1).End(xlUp).row
    
      'Iterate and store in dictionary  
      For row = 1 To lastRow
            x = Split(Cells(row, 1), Application.PathSeparator)
            fileName = x(UBound(x))
            timeString = x(UBound(x) - 1)
            AddDictEntry fileName, row, timeString
        Next row
    
        'Print results
        For Each v In dict.Keys
            Debug.Print "FileName: " & v & ", Recent Version: " & dict.Item(v)
        Next
    End Sub
    

    To add/remove dictionary entries:

    Private Sub AddDictEntry(fileName As String, rowNo As Long, timeString As String)
        Dim timeParts As Variant, timeLong As Long
    
       'converts time string to long, for comparison
        timeParts = Split(timeString, "-")
        timeLong = CInt(timeParts(0)) * 100 + CInt(timeParts(1))
    
        'Adds entry to dictionary if time is more recent
        If (dict.Exists(fileName)) Then
            If CInt(dict.Item(fileName)) < timeLong Then
                dict(fileName) = timeLong
            End If
        Else
            dict.Add fileName, timeLong
        End If
    
    End Sub
    

    Input:

    c:\User\Folder100\13-25\File100.log
    c:\User\Folder200\11-16\File200.log
    c:\User\Folder300\21-20\File300.log
    c:\User\Folder400\13-25\File400.log
    c:\User\Folder400\9-10\File400.log
    c:\User\Folder300\22-20\File300.log
    

    Output:

    FileName: File100.log, Recent Version: 1325
    FileName: File200.log, Recent Version: 1116
    FileName: File300.log, Recent Version: 2220
    FileName: File400.log, Recent Version: 1325
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have an excel file with 10,000 rows in column A some values are
I have an excel file (that I use as a template) with two rows.
I have a function which is processing rows from an excel file.In this function,I
I have a very large excel file, it has about one milion rows and
We have an automatic process that opens a template excel file, writes rows of
I have on excel file with so many rows. It file contains Product Id
I have an excel file that has ~10 columns and 1-20 rows. I need
I have an excel file with 85,000 rows and I need to extract just
I have an excel file which has more than 65536 rows. However, I can
i have one excel file that contains a 1 to a5 rows with values

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.