• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 196
  • Last Modified:

Compare Excel to File Names

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
jmp02008
Asked:
jmp02008
  • 3
  • 2
1 Solution
 
fostejoCommented:
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
 
fostejoCommented:
oops, sorry - in point (5), enther the formula in the next free column (ie. Col B probably)

cheers
0
 
[ fanpages ]IT Services ConsultantCommented:
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
 
[ fanpages ]IT Services ConsultantCommented:
"Micorosoft"?  Ooops.
0
 
[ fanpages ]IT Services ConsultantCommented:
Or not.
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Cloud Class® Course: Microsoft Exchange Server

The MCTS: Microsoft Exchange Server 2010 certification validates your skills in supporting the maintenance and administration of the Exchange servers in an enterprise environment. Learn everything you need to know with this course.

  • 3
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now