Excel can’t create folders by itself, but it can quickly build the commands that do. Put the folder names in column A, and in B2 type ="md """&A2&"""", which produces lines like md “Client A”. Copy the formula down and copy the results. Then open Command Prompt in the folder where you want the new folders and paste. Windows creates one folder per name in seconds. PowerShell and a short VBA macro are two other options. Here’s each method.

Before you start: clean the names
Folder names can’t contain these characters: \ / : * ? ” < > |. Names also shouldn’t end with a space or a full stop. Remove stray spaces with =TRIM(A2), and replace forbidden characters with Find and Replace (Ctrl + H). See how to remove characters from a cell in Excel.
Method 1: Build md commands and run them in Command Prompt
- List the folder names in column A, starting at A2.
- In B2, type
="md """&A2&""""and copy it down. The extra quotation marks wrap each name in quotes, so names with spaces work. - Select the results in column B and press Ctrl + C.
- In File Explorer, open the folder where the new folders should go. Click the address bar, type
cmdand press Enter. Command Prompt opens in that folder. - Right-click in the Command Prompt window to paste, and press Enter after the last line if needed.
The folders appear immediately. If a folder already exists, Command Prompt shows a message for that one and carries on with the rest.
Subfolders
md creates nested folders in one go. If column A holds a client and column B a year, use ="md """&A2&"\"&B2&"""" to create Client A\2026, including the parent folder.
Save it as a batch file
To reuse the list, paste the commands into Notepad and save the file as make-folders.bat in the target folder. Double-click it to run. Check the commands before running any batch file.
Method 2: PowerShell
- Copy the folder names from column A (just the names, no formula needed).
- In File Explorer, open the target folder, type
powershellin the address bar and press Enter. - Run:
Get-Clipboard | Where-Object { $_.Trim() } | ForEach-Object { New-Item -ItemType Directory -Name $_.Trim() -Force }
This reads the names straight from the clipboard, skips blank lines, and creates each folder. -Force stops errors if a folder already exists.
Method 3: A VBA macro
A macro lets you create folders from inside Excel with one click.
- Press Alt + F11 to open the VBA editor, then go to Insert > Module.
- Paste this code, changing the base path to your own folder (keep the backslash at the end):
Sub MakeFolders()
Dim c As Range, basePath As String
basePath = "C:\Projects\"
For Each c In Selection
If Len(Trim(c.Value)) > 0 Then
If Dir(basePath & Trim(c.Value), vbDirectory) = "" Then
MkDir basePath & Trim(c.Value)
End If
End If
Next c
End Sub
- Close the editor, select the cells with the folder names, and press Alt + F8. Choose MakeFolders and click Run.
- Save the workbook as Excel Macro-Enabled Workbook (.xlsm) if you want to keep the macro.
The macro skips blank cells and folders that already exist. If macros are blocked, see how to enable macros in Excel and how to run macros in Excel.
Which method should you use?
| Method | Best for |
|---|---|
| md commands | One-off jobs, with no macros or scripting |
| PowerShell | Quick jobs straight from a copied list |
| VBA macro | Jobs you’ll repeat from the same workbook |
Troubleshooting
“The syntax of the command is incorrect”
A name contains a forbidden character, or the quotation marks are missing. Check the formula in column B.
Access is denied
You don’t have permission to create folders in that location. Choose a folder in your own Documents, or a shared folder you can write to.
Folders are created in the wrong place
Command Prompt and PowerShell create folders in the current folder shown in the prompt. Open them from the target folder’s address bar, as described above.
Related guides
Summary
- Clean the names in Excel.
- Build commands with
="md """&A2&"""", then paste them into Command Prompt opened in the target folder. - Or copy the names and run one PowerShell command.
- Or use a VBA macro for a repeatable, one-click option.
Related: How to Create an Organizational Chart in Excel from a List.

Matt Jacobs has been working as an IT consultant for small businesses since receiving his Master’s degree in 2003. While he still does some consulting work, his primary focus now is on creating technology support content for SupportYourTech.com.
His work can be found on many websites and focuses on topics such as Microsoft Office, Apple devices, Android devices, Photoshop, and more.