In this post we will see how we could insert a file extension like .txt,.xlsx,.pdf etc in a file name that are available in a cell in excel.
There are situations when you have the file name in a cell but you want to have the full name name along with their extensions to be used by your excel formula or you intend to do loop processing on each of the file name via excel macro.
We will try to add file extension to file names that are available in cells in excel.
In the figure below, we have the file name in column A and we want to insert the file extension .xlsx in the file names in column A and the entire file name along with added extension will be shown in column B.
We will use CONCATENATE operator “&” in excel to add file extension to the file name.
Insert the formula =A2&$E$2 in cell B2, notice that I have locked the reference for E2 with double dollar($) symbol because we don’t want the formula to change the extension reference and the same extension in cell E2 will be used across values.
Hit enter after typing the formula.
As you could see in the above figure we have the file name with the extension in cell B2, now drag the formula to get file name with extensions.
Replace the value in cell E2, if you have different file extension such as .pdf,.sas etc.
Hope this helped.