Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

Compare Excel to File Names

Posted on 2006-06-13
5
Medium Priority
?
183 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 500 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

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

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…
The debugging module of the VB 6 IDE can be accessed by way of the Debug menu item. That menu item can normally be found in the IDE's main menu line as shown in this picture.   There is also a companion Debug Toolbar that looks like the followin…
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
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…
Suggested Courses

824 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