Solved

Compare Excel to File Names

Posted on 2006-06-13
5
165 Views
Last Modified: 2010-04-30
I have imported a bunch of data into an excel worksheet that are a list of file names.  I also have a folder with a list of over 20,000 files in that folder.  I want to check if all the file names listed in my excel worksheet are present in that folder, and if they are not, I want to output the particular names into a text file.  I wanted to use the Macros of excel.
0
Comment
Question by:jmp02008
  • 3
  • 2
5 Comments
 
LVL 10

Accepted Solution

by:
fostejo earned 125 total points
ID: 16897670
jmp02008,

You might want to try something like this;

1. Create a text file called 'files.csv' containing the names of all the files in the folder you need to check:
From a cmd prompt type "dir /b /on /a-d >files.csv" - this does a dir using 'B'are format, Ordered by Name and excluding Directories.

2. Open up your spreadsheet containing your current list of filenames - I'll refer to this as the 'reference' list.

3. In Explorer, double click the 'files.CSV' you've just created - being a .CSV, it should open straight into Excel (If your .CSV extension is associated with another piece of software, Open the file itself from within Excel.

4. You should now have both your original 'list of file names' (the reference list) and the 'files.CSV' open in Excel to two seperate sheets

5. In your 'reference list' sheet (on the assumption that your filenames are listed in Column 'A' starting at Row 1), enter the following formula:

=IF(ISERROR(VLOOKUP(A1,files!A1:A999,1,FALSE)),"","Exists")

This formula will attempt to look up the value in A1 against the list in files.csv sheet - if it's found the formula will show 'Exists' otherwise the cell will appear empty.

Note also, that you should alter the 'A999' value to corrospond to the actual number of filenames listed in the 'files.CSV' sheet.

6. Using your mouse, click and drag the formula just entered down Column B (use the bottom right of the cell when dragging)

Note that the VLOOKUP function expects to find exact matches - so please ensure your reference list contains filenames in the appropriate format (ie. without the file path for instance..)

Hope that helps..
0
 
LVL 10

Expert Comment

by:fostejo
ID: 16897691
oops, sorry - in point (5), enther the formula in the next free column (ie. Col B probably)

cheers
0
 
LVL 35

Expert Comment

by:[ fanpages ]
ID: 16898660
Please could you define where in your worksheet the list of filenames resides, that is, define the starting cell & the last cell, and specify if the filenames are fully-qualified with the full path name, or are just filenames?

Also, please indicate which folder you wish to check these files against, and where the resultant output file should be generated (and what it should be called).

Thanks for your clarification.

BFN,

fp.

(PS. The Micorosoft Excel "Topic Area" [where I normally reside] would probably be a more suitable place for this question - you may like to post a "pointer" question there [with a low, say 20, point allocation] to attract more Experts to offer suggestions)

[ http://www.experts-exchange.com/Applications/MS_Office/Excel/ ]
0
 
LVL 35

Expert Comment

by:[ fanpages ]
ID: 16902430
"Micorosoft"?  Ooops.
0
 
LVL 35

Expert Comment

by:[ fanpages ]
ID: 17122249
Or not.
0

Featured Post

Announcing the Most Valuable Experts of 2016

MVEs are more concerned with the satisfaction of those they help than with the considerable points they can earn. They are the types of people you feel privileged to call colleagues. Join us in honoring this amazing group of Experts.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction In a recent article (http://www.experts-exchange.com/A_7811-A-Better-Concatenate-Function.html) for the Excel community, I showed an improved version of the Excel Concatenate() function.  While writing that article I realized that no o…
When designing a form there are several BorderStyles to choose from, all of which can be classified as either 'Fixed' or 'Sizable' and I'd guess that 'Fixed Single' or one of the other fixed types is the most popular choice. I assume it's the most p…
Get people started with the process of using Access VBA to control Excel using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Excel. Using automation, an Access application can laun…
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…

816 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

9 Experts available now in Live!

Get 1:1 Help Now