This tutorial will cover exactly that – How to Convert Excel to PDF or PDF to Excel.
PDF files are a widely used format for electronic documents. They are used when you need to save a file without modification so that it can be easily shared and printed. By default, an Excel Workbook is saved as a .xlsx file type.
But you can easily convert Excel to PDF format. Similarly, you can easily create tables from the PDF document using Excel.
This article will cover the following two conversion methods in detail:
Let’s look at both ways one-by-one!
Make sure to download the Excel Workbook below and follow along:
Table of Contents
Want to know how to convert excel to pdf and pdf to excel?
*** Watch our video and step by step guide below with free downloadable Excel workbook to practice ***
Watch it on YouTube and give it a thumbs-up!
Convert Excel to PDF
PDFs can be easily shared and can be viewed on any platform without a change in format. So, learning how to convert Excel to PDF is extremely essential!
There are 5 different methods in which you can convert Excel to PDF:
- #1 – Using Save as Option
- #2 – Using Export Option
- #3 – Export using Quick Access Toolbar
- #4 – Email PDF using Quick Access Toolbar
- #5 – Using VBA
Follow the step-by-step tutorial on how to convert Excel to PDF using the Save As option:
STEP 1: Select the Excel table that you want in the PDF Format.
STEP 2: Click on File Tab.
STEP 3: Select Save As > Browse.
STEP 4: In the Save As dialog box, select the location where you want to save the PDF file.
STEP 5: Under Save as type dropdown, select PDF.
STEP 6: Click on the Options button to customize the PDF file you want to create.
STEP 7: In the Options dialog box, Go to Publish what section and click on Selection. Then, Click OK.
This will help you to publish only what you have selected on the sheet. To publish the entire sheet, click on Active Sheet(s), and to publish the workbook click on the Entire Workbook.
STEP 8: Click Save.
This will save you Excel Table in PDF format.
The Export option in Excel will provide you with a quicker way to save your file as PDF.
STEP 1:Go to the File Tab.
STEP 2: Click on Export > Create PDF/XPS Document > Create PDF/XPS Document button.
STEP 3: In the Publish as PDF or XPS dialog box, click on Publish.
#3 – Export using Quick Access Toolbar
If converting Excel to PDF is a regular task for you, you can add it to the Quick Access Toolbar (QAT). Follow the steps below to add Publish as PDF option to the QAT:
STEP 1: Right Click on the QAT to customize it.
STEP 2: In the Excel Options dialog box, select Quick Access Toolbar > Publish as PDF or XPS > Add.
STEP 3: This will add Publish as PDF under Customize Quick Access Toolbar. Now, Click OK.
STEP 4: This will add Publish as PDF/XPS to the Quick Access Toolbar.
STEP 5: Simply click on the icon, select the file location you want to save it at and click on Publish.
#4 – Email PDF using Quick Access Toolbar
If you want to attach an Excel file as PDF in an email, you can add it to the Quick Access Toolbar (QAT).
Follow the steps below to email PDF as QAT:
STEP 1: Right Click on the QAT to customize it.
STEP 2: In the Excel Options dialog box, select Quick Access Toolbar > E-mail as PDF Attachment > Add.
STEP 3: This will add E-mail as PDF Attachment under Customize Quick Access Toolbar. Now, Click OK.
STEP 4: This will add E-mail as PDF Attachment to Quick Access Toolbar.
You can also use VBA code to publish a range in Excel into PDF. This VBA will prompt you to provide the range you wish to export and then select the location, to automatically export Excel to PDF.
Copy Source Code
‘MyExcelOnline.com – PrintSelectionToPDF
Sub PrintSelectionToPDF()‘Declaration of Variables
Dim rng As Range
Dim strFilePath As String
Dim strFile As String
Dim file As Variant‘Check first if a range has been selected
If Selection.Count = 1 Then
Set rng = Application.InputBox(“Please select a range”, “Get Range”, Type:=8)
Else
Set rng = Selection
End If‘Create the filename with the path – the default filename is ExceltoPdf.pdf
strFile = “ExceltoPdf.pdf”
strFile = ThisWorkbook.Path & “\” & strFile‘We open a save prompt for the username to select the location and filename
file = Application.GetSaveAsFilename(InitialFileName:=strFile, FileFilter:=”PDF Files (*.pdf), *.pdf”, Title:=”Select location for the PDF file”)‘Start the export process of the selected range
If file <> “False” Then
rng.ExportAsFixedFormat Type:=xlTypePDF, Filename:=file, Quality:=xlQualityStandard, IncludeDocProperties:=True, IgnorePrintAreas:=False, OpenAfterPublish:=False
MsgBox “PDF file has been successfully created: ” & strFile
Else
MsgBox “Unable to create PDF file”, vbOKOnly, “No File Selected”
End IfEnd Sub
Follow the steps below to use this VBA code to Export selection to PDF:
STEP 1: Press Alt + F11 to open VBA Editor.
STEP 2: Right Click on the sheet name and then select Insert > Module.
STEP 3: Copy-paste the VBA code from above into here.
STEP 4: Press Ctrl + S to save the file and then click No.
STEP 5: In the Save as dialog box, choose Excel macro-enabled workbook from the drop-down list and click the Save button.
STEP 6: Press Alt + F8 to open the Macro dialog box.
STEP 7: Select the Macro PrintSelectionToPDF that is located in All Open Workbooks and click Run.
STEP 8: In the dialog box, type the required range – A1: F8.
STEP 9: Select the location and press Save.
This is how you can convert the range A1: F8 in excel to PDF.
Convert PDF to Excel
PDF does not allow users to make edits on the data so it might be useful to learn how to convert the data from PDF to Excel. If you have a table saved in PDF, you can easily get that imported in Excel and work on it easily.
The two methods for converting PDF to Excel are:
The most simple method to convert PDF to Excel is to copy & paste the data. Let’s look at an example to understand this better.
Follow the steps below for a detailed tutorial on PDF to Excel converter:
STEP 1: Press Ctrl + A and Ctrl + C to select the entire data and copy the data in PDF.
STEP 2: Open the Excel File and simply press Ctrl + V to paste the data in Excel.
Even though, you have got the data in Excel it is not formatted in the way you want. You can use different functions of Excel to format that like Text to Column, Index Formula, OFFSET Formula, etc.
In this example, you need to transpose every 5th row into a single row using OFFSET Formula.
STEP 3: In the blank cell C1, start with the OFFSET formula to transpose the data
=OFFSET($A$1
This will provide Excel with the starting point to extract data from i.e cell A1.
STEP 4: Now, type the second argument the provides Excel with the number of rows, up or down, that you want the top-left cell of the result to refer to.
=OFFSET($A$1,COLUMNS($A1:A1)-1+(ROWS($1:1)-1)*5, Here:
- COLUMNS ($A1: A1) will count the columns in the defined range and it will expand by keeping the first reference frozen ($A1) and the second reference (A1) relative. When you will drag the formula right, the column count will increase.
- Similarly, ROWS ($1:1) will count the rows in the defined range and it will expand by keeping the first reference frozen ($1) and the second reference (1) relative. When you will drag the formula down, the row count will increase.
- Moreover, we are multiplying (ROWS($1:1)-1) with 5 because we want to transpose every 5 rows from 1 column to multiple columns.
- Lastly, say if we want to transpose data from cell A1 to C1. We need to subtract 1 from both COLUMNS and ROWS function Excel to say in the same row and column from the starting point i.e. A1.
STEP 5: Type the third argument the provides Excel with the number of columns, to the left or right, that you want the top-left cell of the result to refer to.
Since the entire data is in the same column i.e. Column A, the third argument will be 0.
=OFFSET($A$1,COLUMNS($A1:A1)-1+(ROWS($1:1)-1)*5,0)
STEP 6: Drag this formula right till Column G.
STEP 7: Again, drag down till row 46 to incorporate the entire table.
STEP 8: Change the Date & Currency format, make the header bold and insert borders.
Your Data Table is ready!
Let’s look at how Excel retrieves a value using this formula in a particular cell (say E4).
=OFFSET($A$1,COLUMNS($A4:C4)-1+(ROWS($1:4)-1)*5,0)
=OFFSET($A$1, 4-1+(ROWS($1:4)-1)*5,0)
=OFFSET($A$1, 3+(4-1)*5,0
=OFFSET($A$1,18,0)
=John Michaloudis
#2 – Import Data from PDF to Excel
In most cases, you will be able to simply copy & paste the data and format it to get the desired result. But if that is not working for you, use the Import Data method in Excel.
Follow the steps below to import data from PDF to Excel (For Excel 365 only):
STEP 1: Go to Data Tab > Get Data > From File > From PDF.
STEP 2: In the Import Data dialog box, select the location of the PDF file, and click on Import.
STEP 3: In the dialog box, select the table from the left panel and click on Load.
This will convert the table from PDF to Excel!
Conclusion
In this article, you have learned how to swap between the two most commonly used file formats – Excel & PDF.
When you need a file in PDF format for sharing or printing – Convert Excel to PDF by using either the Save as or Export option.
Similarly, when you need to make edits in a PDF file – Convert PDF to Excel by using either the copy-paste technique or the Import Data feature in Excel 365.
You can learn more about how to import or export files in Excel by going through this tutorial by Microsoft.
HELPFUL RESOURCE:
Make sure to download our FREE PDF on the 333 Excel keyboard Shortcuts here:
You can learn more about how to use Excel by viewing our FREE Excel webinar training on Formulas, Pivot Tables, and Macros & VBA!
Further Learning:
- Save Selected Range as PDF Using Macros In Excel
- Save Each Worksheet as a PDF File Using Macros In Excel
- How to Save Word as PDF
You can follow our YouTube channel to learn more about How To Merge Cells in Excel!
John Michaloudis is a former accountant and finance analyst at General Electric, a Microsoft MVP since 2020, an Amazon #1 bestselling author of 4 Microsoft Excel books and teacher of Microsoft Excel & Office over at his flagship MyExcelOnline Academy Online Course.