[Tutorial] Create a folder structure in Excel

I am creating a knowledge repository for my team and I wanted to create a neat index file. The aim is to have a tree structure and the end result to be a HTML page. I have started with the HTML Kickstart framework and with some help from the internet, I am in the progress of creating a nice intranet page for the repository (I will probably add a post on my experience once complete). In the meanwhile, I need a temporary index that I can share with others so that they can access documents right away.

I decided to go the Excel way, but without macros or other complex steps. You too can create a basic tree structure for any folder to help you keep track of its contents. So if you have the folder ready and Microsoft Excel is just a double-click away, let’s get started.
1 As always start with a blank new workbook. The screenshots are from Excel 2013, but would work on pretty much every version from 2003.

2 Hide Gridlines. From the ribbon, goto View and uncheck the Gridlines box to remove the grid and be left with a blank white worksheet.

3 Adjust Column Widths. Select fifteen columns from C through Q to 4. Here are the screenshots on how to do it.

4 Navigate to the folder of choice and with the Shift Key pressed, right click on an empty area of the folder. In the contextual menu, select Open command window here.

5 List the contents of the directory (including sub-directories) into a text file by issuing a dir /s /b > tree.txt command from the command window.

6 Open the text file tree.txt (it will now be visible in the Explorer window) and copy the entire content. Paste the content into columns A & columns C of the excel worksheet.

7 Select contents of Column A & Column C and sort them on Column C by alphabetical order.

8 Select all cells of Column A and change the font color to White (or the background color of the sheet if you have at some point changed it).

9 Split data into columns with text to columns by selecting all data in column C and the Text to Columns option on screen. The delimiter is \.

10 Select all the cells from column C to Q with data and we shall apply some conditional formatting to make the content look better. From the Home tab in the ribbon, select Conditional Formatting and click on New Rule. From the popup window, select “Use a Formula to determine which cells to format” and enter the following formula =AND(NOT(ISBLANK(C2)),C2=C1) Please note that I have filled data from row 2 and cell selection has started from C2
After entering the formula, click on Format and make the following changes. First, within the Font tab, set Color as White (or the worksheet background color). Next, in the border tab, give a right border of your choice. I have chosen a dotted grey line.

11 Here is the resultant screen after conditional formatting.

12 You can hide (or even delete) the columns which contain the information upto the current folder. In my example, I was in the FirefoxPortable folder and I could hide/delete all columns that contained D: or Program Files or FirefoxPortable. It reduces clutter and makes the sheet more presentable.

13 Create hyperlinks in column B to navigate to the directory/file within seconds by entering the formula =HYPERLINK(A2,8) in cell B2. There is nothing magical about the number 8, it is just that it represents a mouse icon in Wingdings. You can choose your own font and your own text instead of 8

14 Finally, drag the bottom right corner of cell B2 till the last row with data. This copies the formula in cell B2 making all other cells in Column B a hyperlink.

There you go, a navigable Folder structure right out of Excel.

Excel Macro : Repetitive Ctrl+C (and some more)

My Excel skills are being tested quite often now. I had to work on a repetitive task to close a large list of support incidents. The input list of incident numbers were in an excel sheet and for each, I had to go to the incident management software and update some fields (primarily drop-down selections) prior to closure. As any gamer would attest, it is not much fun having to switch between two sides of the keyboard when also working with a mouse. Hence the act of Ctrl+C & Ctrl+V would be interrupted by having to use the down arrow and get to the next cell. I decided to write an Excel Macro that would go to the next cell below, select it and copy it. If you think it would be tough, think again. Here is the code.

Public Sub NextRowCopy()
    Dim currRow As Integer
    currRow = ActiveCell.Row
    currRow = currRow + 1
    Range("C" & currRow).Select
End Sub

I pasted this in a new module in my workbook (Alt+F11 » Right Click Workbook in Project Explorer to the left and Insert » Module). As you would have guessed, the incident numbers were in column C. After saving the macro, I went back to the workbook. I pressed Alt+F8 to see the NextRowCopy macro in the popup window. Selected it and clicked on Options, assigned it a shortcut Ctrl+Q (again for the same reason that Q was to the same side of the keyboard as C).

Once I updated the Incident, I would do a Ctrl+Q and I would have the next incident number to be worked on.

The And Some More part

Most of the fields to be updated in the system were dropdown selections, but there was a standard text to be updated as well. I couldn’t copy it from excel since it would change my cursor location and I didn’t want to have to open a notepad and cycle three windows for this. I searched for a multiple clipboard manager and decided to use QuickTextPaste. It lets you assign shortcuts to predefined text, run programs and more.

My task was completed and while looking back at my macro, I think I could have had excel do the copy of the predefined text as well. Let us say that the existing data was from columns A through N. I could add the text I needed to paste in Column Q and have the macro check where I was currently and move to the right cell.

Public Sub NextRowCopy()
    Dim currRow As Integer
    currRow = ActiveCell.Row
    currCol = ActiveCell.Column
    If currCol = 3 Then
        ' We are in the incidents column. Switch to column O
        currCol = "O"
        ' We are in new column O, switch to column C in the next row
        currCol = "C"
        currRow = currRow + 1
    End If
    Range(currCol & currRow).Select
End Sub

Each time the macro ran, my clipboard had either the incident to be searched or the text to be entered to close the incident. Total time saved:  30 minutes 

[Template] – Meeting Minute Taker in Excel

Slicers are a pretty cool filtering feature available in Excel 2010 and above. In a few words, slicers help you filter a table (pivot or otherwise) by simply clicking on the items you wish to see. You can create multiple slicers for a table, letting you play with data in ways which was not possible with simple Filters. Using filters was often cumbersome since you had to scroll left & right to find the right columns. Data available for filtering would be restricted to available entries from previous filters and often left you wondering which column was filtered causing your table to show partial data.

If I have you hooked on slicers, head over to the post at office.com and be sure to come back here for the meeting minutes template.

Meeting Minutes Template

The template consists of two sheets – Meeting Minutes and Team List. Some data has been pre-populated so that you can see how the slicer works. This data can be safely deleted (Select cells & hit delete, don’t delete entire rows). First, head over to the Team List sheet and enter your team members in the table. As you add more data, you will notice that the table automatically expands and you can see the alternate shading. On the Meeting Minutes sheet, you might want to replace The Science of Deduction with your own team name. Begin entering data in the table below the slicers and you are good to go.


Here are some additional points you will want to consider

  • The drop-down for Type and Status is from Data Validation. Feel free to change the list, by selecting the column in the table and modifiying the Data Validation Settings.
  • You can add more columns to the Meeting Minutes/Team List. If you add columns after the last column, make sure you the table has expanded to cover the new columns. Excel will automatically do this for you, however, if it doesn’t happen you need to pull the small blue inverted L shape on the last cell on the last row of the table
  • New slicers can be inserted easily. Select an cell within the table, a new tab should be visible in the Office Ribbon called Design (under Table Tools). Click on Insert Slicer and follow the simple instructions on screen
  • You can switch between sheets using the buttons on the left side of the sheet.


Meeting Minute Tracker
Meeting Minute Tracker
21.9 KiB

Planning leaves for your team – Excel Template

Vacationing Woes for the ManagerRecently, the Project/Resource estimation template crossed over the 1000 download mark. Thanks to all you folks who used the template to plan and manage your projects. I thought I would commemorate that with another Team Planning Template – this time to plan leaves and Holidays.

When your team member plans for a vacation or the holiday season is just round the corner, you need to rework your schedule and maybe the delivery dates. Sometimes it is not clear how many team members are not available on a particular day, since each person may talk to you about their leave plans on different dates. The Leave Planner template gives you good control over your team’s leaves.

Some key features of the Leave Planner are:

  • Track upto 50 team members in one place. You can even distinguish between sub-teams
  • Customize your work week. Does the team work Tuesday through Saturday? No problem, this planner can handle it
  • Track Leave status changes from “Applied” to “Approved” or “Rejected”
  • Enter holidays upfront so you can schedule the team’s work accordingly. Plus you can easily see when there will be a deluge of leave requests (around long weekends)
  • Create Comp-offs, see Unplanned leaves and much more

The template has a “How-To” sheet that guides you through the process of setup and using the leave planner. Download link follows the screenshots.

The sheet works in Excel 2007 and above. Using the template in an earlier version can lead to undesirable results due to limitation of conditional formatting in older versions of Excel


Leave Planner - How to Guide
The inbuilt How-to Guide gets your started and answers all your queries
Leave Planner - Control Sheet
The Control sheet lets you setup parameters such as Holidays, Work week and also the team details
Leave Planner - Master Sheet
Dashboard of the leaves. Add or update leave plans
Leave Planner - Summary Table
The top summary section gives you an update on the latest leave counts for your team members
Leave Planner - Color coded days
Easy color coding lets vacation days stand out


Leave planner for the team
Leave planner for the team
74.3 KiB

Screen capture from the mainframe

If I wanted any proof that I was a resillient and obssessive automator, this incident was more than sufficient. Our team was faced with a predicament – the business wanted to get some reports downloaded from the testing region. Usually this was an easy process, we could download the report From CA-View and email or FTP it.

After a migration to a new firewall, FTP & email stopped working and we had to download reports that were more than 1000 pages. The last option (not the best, but had to be done) was a screen capture process. I had three options

  • VB.Net to use the Quick3270 Object and extract the data
  • Excel and VBA to capture screenshots (again with the Quick3270 Object)
  • Quick3270 Macro Language

I tried each and every option from the list above (in the same order). VB.Net seemed to be an overkill. I had to create forms (to collect screen details, logon information etc.)


VBA & Excel was looking like a good option; I had worked with this combination in the past when we had to download the entire list of FCTs from the CICS region (CEMT & Screen capture did a pretty good job). The screen capture Excel Macro worked well, except for a couple of points which didn’t make this the option of choice. Firstly, the macro could capture data one line at a time (since the code needed to identify the last line of the data on the screen). Secondly, due to login process, screen navigation, etc., one couldn’t guarantee that the user was on the right page. Finally, it was nearly impossible to pause/stop the macro without force closing the program.

Quick3270 Macro it was. While it is based on Visual Basic commands and structure (it even has constants such as vbOkOnly), it does not have the entire instruction set. Picking up parts from the VBA code and modifying it for the Macro language, the final product was ready.

The Macro language had decent support for File I/O and could create Excel.Application Objects. With this, I gave flexibility to the user to route the output into a new excel sheet or into a text file. The language did not support arrays, which meant that concatenating data across screens (scrolling horizontally) required some long winding logic. Creating 24 different variables (one for each line), assigning them data, scrolling and appending data, this took up about 1/3rd of the macro coding. Similar pages of code had to be written for outputting data (variable by variable).

The reference Guide for the Quick3270 Macro language can be found on the dn-computing downloads page. I must warn you that the Macro language is specific to the version you are using. The manual is for v4.12, do take this in consideration while starting to code.

With my battle scars to show for and a running macro, I think I will keep this language in mind during future ventures into Mainframe Automation.

Estimate your Project and Resources with Excel

Forget fancy programs and tools, your dear old Excel (even the plain-jane 2003 version) can provide you excellent planning options for your project. Having worked with multiple projects and across geographies, it is often important to plan the project to the level of each day. You can use this template to handle your project tasks by drilling down to the minute level of day-to-day tasks. Plan for resources who are spread across locations and also estimate the cost required for the project using parameters.

To use the estimation sheet, open the Excel template and update the parameters in the sheet “Parameters”. Instructions are available on the page on mandatory fields and explanation of each parameter. Once you are done, move on to the second Sheet “Resource Loading” and start entering your tasks along with the effort involved.

This template contains no macros and has been tested in Microsoft Excel 2003 & Excel 2007. If you enjoyed using this sheet or need a quick modification, drop me a comment.

Project Tracker Xlt
Project Tracker Xlt
63.4 KiB
 Thanks to our reader Arvin for identifying an issue with the offshore rate computation. This has been fixed. 

My first Windows application

Sometimes opportunities just sprout up and you take it for all its worth. One such opportunity showed up last Friday. The client wanted a report of all transactions done via MasterCard from January 2011 to March 2011 split day wise. We had a few history files of transactions, but it would have been given us 75% of what business wanted. There were consolidated daily reports, that stored the details of all transactions entering the system. This was a huge report (average report size was 70 MB) and the data we needed was a mere 5-10% of the entire report.

Typically, such reports are uploaded to the mainframe and we write small programs to extract data and reformat it into another report. Uploading 90 days worth of data via a single link FTP was taking ages. We aborted the mission when one 70 MB file took 5 hours to upload. The next logical step was to find a way to code a filtering process on the report on the desktop. Knowing that VBA macros/modules can open and read text files, I fired up Visual Studio 2005 to create my first windows application.

Time was short, so I resisted the temptation to use complex controls. The basic flow was something like this
Flowchart for ReportXtract
The logic was simple, use the StreamReader & StreamWriter object to read the report file and write into the extract file. When I wanted to send the file to my team (we had a lot of files and parallel processing was badly needed), I was able to create an installer within minutes. I would have loved to write the output into an Excel file, but had to settle for a pipe-delimited output text file. A final manual step to import text to Columns in Excel was required. Version 2.0 will have option to directly navigate to the report as well as give the user an option to choose multiple filter options for selecting the transactions.

For all it was worth, I enjoyed the experience. How did you feel when you wrote the first program?
PS: Here is the image of the ReportXtract application (pretty sparse UI)
Screenshot of the ReportXtract program