The post Download Excel App to Fill Out PDF Forms appeared first on Excel First.

]]>In an older article: Use Excel to populate PDF Form Fields, I presented a manual method to transport data between Excel and PDF forms, that can be used without a paid version of Adobe Acrobat.

If you have Adobe Acrobat Pro installed, then you can use an Excel App to Fill Out PDF Forms automatically, directly from Excel.

First, download the sample PDF form and the Excel Form Filling Tool from the link below:

First of all, there is a main folder, named **Form Filling Tools**, that will contain a folder with **Templates, **all your PDF templates must be stored in the **Templates** folder.

Inside the** Form Filling Tools **folder, there is an Excel file named **Fill PDF Form.xlsm**, this will be our Excel tool that will help us Fill PDF Forms automatically.

When the Excel App will fill a form, it will save it in a folder named **Filled Forms**, which will be created by code inside the main folder – **Form Filling Tools. **

The** Filled Forms **folder is not in the archive you downloaded from the above link, it will be created automatically.

Also, the code will create a sub-folder in **Filled Forms** for each row of data.

If you have a PDF template to fill for John Doe for example, a sub-folder named **John Doe** will be created in **Filled Forms** folder, and that PDF template will go into **John Doe** folder.

Each PDF created by code will have a time stamp in the file name, to avoid overwriting older forms and to allow you to find the most recent versions.

I tried to build a flexible structure, to allow users to use this tool with their own PDF Forms. As a result, there are 2 important sheets in the **Fill PDF Form.xlsm: **

- Data, which holds a defined table with all your source data, that needs to be sent to PDF forms.
- Templates List. This sheet will have the details of the selected PDF Template from the Templates folder, the table must be updated using the button named Update Templates List from this sheet. In this version, only 1 PDF Form will be listed.

In order to start using the tool, you have to do the following steps:

- Press the button named Update Templates List from Templates List sheet, the code will ask you to select a PDF from the templates folder, and
**for that PDF form will create a new worksheet**, with all the form fields listed: PDF field**Names**, field**User Names**and field**Type**. - After the first step, a new sheet will be created for the selected form. The first column in the template sheet has drop-downs, referring to the Data table Headers, you will have to
**map each field from Data table to the corresponding PDF Field Name from column B**: look at column B (PDF field name, and select from column A drop-down the value that should be sent to that field).

Because the PDF Field Names can be different from your Data Table Headers, **without this mapping, no data will be sent to PDF form**, it’s the only reasonable way to make an association between your Data Headers and the PDF Field Names.

Finally, we can start filling those Forms! Go to Data sheet and double-click on a name from column A, this is the event that triggers the Form Fill Action.

The code will create a copy of the PDF Form from the Templates folder and it will fill it with data from the selected row from Data sheet.

In conclusion, I have to emphasize a few issues that might raise errors in this process:

- This Excel App to Fill Out PDF Forms will work only with AcroForms, you will not be able to fill forms that were created with Live Cycle Designer (those are XFA Forms).
- If you did not create the PDF Form, or you created the form automatically with Acrobat Tools, most probably you will find a few ambiguous PDF Fields Names, like TextBox1, TextBox2.

It will not help when you do the data mapping. You will have to edit the form to rename those fields, then use the button to Update the Templates List.

There are many improvements that can be made. For example, you may want to:

- pre-fill the PDF templates from your Templates folder with data, and fill only some fields from Excel.
- Or, you may want to type default values for some fields, because you don’t have data for those fields in your Data table.
- Also, a user may want to fill lots of PDF Forms, stored in Templates folder and in subfolders.
- Another frequent operation some user may need to do is to fill forms for each row in Data sheet, not just one row at a time.

You can do these changes by editing the code, if you have experience with VB programming.

Enjoy!

Catalin Bombea

The post Download Excel App to Fill Out PDF Forms appeared first on Excel First.

]]>The post LEN function: Basic and Advanced Examples appeared first on Excel First.

]]>Description: Returns the number of characters in a text string

LEN is a basic function widely used, many formulas built for text processing will need this function.

Take a look at the advanced applications examples:

**Applications:**

- Get the text with the lowest length from a column (first match only)
- Count how many cells within a range of cells have a text length higher than normal

**Download** the LEN function demo: LEN.xlsx

**Function Arguments:**

**=LEN(text)**

Argument | Microsoft Description |

text |
The text whose length you want to find. Spaces count as characters. |

Note: If you are already familiar with basic use of the LEN Function, click here to **Go To Advanced Examples.**

**Basic Example:**

Note that all characters are counted, including spaces or other invisible characters, like Alt+Enter, which inserts a new line into the same cell ( or char(10), in cell D24).

**Application 1: Get the text with the lowest length from a column (first match only):
**

**Note:** The references used in the text below are the same used in the downloadable workbook.

**Method:** Instead of passing a single cell reference to LEN function, we can pass an array of cells, the return will be an array of text length: =LEN(C38:C41) will result in: {6;5;9;8}. This is an array formula, confirmed with Ctrl+Shift+Enter, not just Enter after editing the formula.

If we compare the length of the cells from a range with the smallest text length from the same range, we get an array of row numbers: IF(LEN(C38:C41)=SMALL(LEN(C38:C41),1),ROW(C38:C41),””)={“”;39;””;””}. Note that in the result array we will have row numbers only for the matching rows, the rest of cells will return a zero length string.

Using again the SMALL function with the array of results {“”;39;””;””}, will return the row number of the first match found: =SMALL({“”;39;””;””},1)=**39**

**Full Formula (confirmed with Ctrl+Shift+Enter):**

=INDEX(C:C, SMALL(IF(LEN(C38:C41)=SMALL(LEN(C38:C41),1),ROW(C38:C41),””),1))

Note that blank cells within the range will be taken into consideration, they will become the cells with the smalest length: 0.

**Application 2: Count how many cells within a range of cells have a text length higher than normal:
**

Problem description: If you have a list of Product Codes, and those codes should have a limited number of characters, 7 for example, the formula based on LEN function will return the number of items where the text length is below or above 7.

**Method**:

Passing a range to LEN function, instead of a single cell reference, will return an array of results:

=LEN(C51:C54) will return: {7;6;7;8}

Comparing the lengths array with 7, will return an array with TRUE or FALSE:

=LEN(C51:C54)<>7 returns: {FALSE;TRUE;FALSE;TRUE}

If we convert the TRUE and FALSE result to numeric values, by multiplying the array with 1, we get an array of 0 and 1:

=(LEN(C51:C54)<>7)*1 will return: {0;1;0;1}

All we need to do is to SUM the array of results:

=SUMPRODUCT((LEN(C51:C54)<>7)*1)

Note: due to the nature of SUMPRODUCT function, which is a native array function, the formula can be used as a regular formula, not an array formula.

Same result can be achieved with SUM function, but because SUM function is not a native array function, the formula should be entered as an array formula, with Ctrl+Shift+Enter, otherwise the result will be incorrect:

=SUM((LEN(C51:C54)<>7)*1)

If you inserted the formula correctly, you will see it in the formula bar surrounded by curly brackets, including the equal sign:

**{**=SUM((LEN(C51:C54)<>7)*1)**}**

The curly brackets are indicating that the formula is an array formula. The curly brackets **are not manually typed**, Excel will **automatically** create them when you press** Ctrl+Shift+Enter** keys after editing the formula.

**Tip:** To easily find the rows with problems, you can use a simple conditional formatting rule, based on text length. In this example, I set a rule applied to C51:C54, with a formula: =LEN($C51)<>7. See the downloadable workbook for a functional example.

Enjoy

Catalin

The post LEN function: Basic and Advanced Examples appeared first on Excel First.

]]>The post SUBSTITUTE function: Basic and Advanced Examples appeared first on Excel First.

]]>Description: Substitutes the old text with new text in a text string

Beyond its basic use, which is fairly simple, the SUBSTITUTE function can be very useful combined with other functions, to get your desired results.

Take a look at the advanced applications examples:

**Applications:**

- Substitute last occurrence only
- Extract partial string after last delimiter
- Extract item from delimited text, based on item position

**Download** the SUBSTITUTE function demo: SUBSTITUTE.xlsx

**Function Arguments:**

**=SUBSTITUTE(text, old_text, new_text, [instance_num])**

Argument | Description |

text |
The text or the reference to a cell containing text for which you want to substitute characters. |

old_text |
The text you want to replace. |

new_text |
Replacement text for old_text |

[instance_num] |
Optional. Allows you to specify which occurrence should be replaced. If this argument is ommited, every occurrence of old_text will be replaced with new_text. |

Note: If you are already familiar with basic use of this Function, click here to **Go To Advanced Examples.**

**Basic Example:**

Text to process: “**Mary has a cat. Her cat is 1 year old.**”

Replace all occurences (instance_num argument is omitted):

=SUBSTITUTE(“Mary has a cat. Her cat is 1 year old.”,“cat”,“dog”)

Result: Mary has a dog. Her dog is 1 year old.

Replace first occurence:

=SUBSTITUTE(“Mary has a cat. Her cat is 1 year old.”,“cat”,“dog”,1)

Result: Mary has a dog. Her cat is 1 year old.

You can always use cell references to pass them to function arguments. For example, if cell A1 contains the text argument: “Mary has a cat. Her cat is 1 year old.”, A2 has the old_text argument: “cat” and A3 has the replacement (new_text argument) – “dog”:

=SUBSTITUTE(A1, A2, A3, 1)

**Application 1: Substitute last occurrence only**

Text to process: “Mary has a cat. Her cat is 1 year old.”

old_text: “cat”

new_text: “dog”

instance_num: formula to calculate the number of occurences of the old_text in the text argument.

Formula for instance_num:

=(LEN(“Mary has a cat. Her cat is 1 year old.”)-LEN(SUBSTITUTE(“Mary has a cat. Her cat is 1 year old.”,”cat”,””)))/LEN(“cat”)

**Method used:** By deducting from the length of the initial text the length of the string where the old_text is replaced **with a zero length string (“”)**, the result will be the number of old_text occurences.

Note: if the old_text has more than 1 character, you have to divide the result with /LEN(“cat”), otherwise the result is wrong.

**Full Formula:**

=SUBSTITUTE(“Mary has a cat. Her cat is 1 year old.”,“cat”,“dog”, (LEN(“Mary has a cat. Her cat is 1 year old.”)-LEN(SUBSTITUTE(“Mary has a cat. Her cat is 1 year old.”,”cat”,””)))/LEN(“cat”))

**Result:** “Mary has a cat. Her dog is 1 year old.”

**Application 2: Extract partial string after last delimiter**

**Example 1**: Initial text string: SKU-22B7-**99F5**

**Note:** the initial string is stored in cell **A1**, this reference will be used in all examples.

**Target:** extract the last item from the initial string: **99F5**

**Method**: replace the last “-” delimiter with a unique delimiter, “^” in this example, (which is not present in the original string), then identify this new delimiter in the new string (with the last delimiter replaced). The last step is to extract the last part of the string using the RIGHT function, based on the position of the last delimiter replaced, determined with FIND function.

**Step 1**: Replace last delimiter:

=SUBSTITUTE(A1,”-“,”^”,LEN(A1)-LEN(SUBSTITUTE(A1,”-“,””)))

Step 1 Result: SKU-22B7**^99F5 **

**Step 2**: Extract the string after the last delimiter:

=RIGHT(A1,LEN(A1)-FIND(“^”,SUBSTITUTE(A1,”-“,”^”,LEN(A1)-LEN(SUBSTITUTE(A1,”-“,””)))))

Step 2 Result:** 99F5**

**Example 2**: Initial text string: http://www.fonearena.com/blog/87685/**lenovo-p780-camera-samples.html**

**Method**: replace the last “/” delimiter with a unique delimiter: “^” , identify the new delimiter in the new string and extract the last part, after the last delimiter “/”:

**Step 1**: Replace last delimiter:

=SUBSTITUTE(A1,”/”,”^”,LEN(A1)-LEN(SUBSTITUTE(A1,”/”,””)))

Step 1 Result: http://www.fonearena.com/blog/87685**^lenovo-p780-camera-samples.html**

**Step 2**: Extract the string after the last delimiter:

=RIGHT(A1,LEN(A1)-FIND(“^”,SUBSTITUTE(A1,”/”,”^”,LEN(A1)-LEN(SUBSTITUTE(A1,”/”,””)))))

Step 2 Result: **lenovo-p780-camera-samples.html**

**Application 3: Extract item from delimited text, based on item position**

Example 1: Initial text string: **first-/second-/third-/fourth-/fifth-/sixth-/seventh**

Take a look at the following 3 formulas, each has a different approach. The most simple and efficient approach is the last formula, the credit goes to **Rich Rothstein** for developing this solution.

The only difference is that in Rich Rothstein’s formula, the list is in reversed order, the count starts from the last item from the delimited text string. I built the first 2 formulas just to show you that there can be multiple solutions to the same problem, you can build your own version.

**Formula 1** (A1 has the text, A2 contains a number corresponding to the position of the desired item):

=MID(“-/”&A1&”-/”,FIND(“^”,SUBSTITUTE(“-/”&A1&”-/”,”-/”,”^”,A2))+LEN(“-/”),FIND(“^”,SUBSTITUTE(“-/”&A1&”-/”,”-/”,”^”,A2+1))-FIND(“^”,SUBSTITUTE( “-/”&A1&”-/”, “-/”,”^”, A2)) -LEN(“-/”))

**Formula 2** is the “ugliest” approach, you will find it only in the **attached workbook**.

The interesting part in this approach is the use of **an array of values** to instance_num argument of the SUBSTITUTE function, will return an array of results. The array of results is used in FIND function: FIND(“^”,SUBSTITUTE(“-/”&D62&”-/”,“-/”,“^”,{1;2;3;4;5;6;7;8}))

FIND function will return this array: {1;8;16;23;31;38;45;54}, which is the position of ALL delimiters (including the additional delimiters).

The array of values for instance_num argument is not hard typed, it is dynamically created by this part of the formula: ROW(A1:INDEX(A1:A100,(LEN(A1)-LEN(SUBSTITUTE(A1,”-/”,””)))/LEN(“-/”)+2))

**Formula 3 **(A1 has the text, A2 contains a number corresponding to the position of the desired item, **from last to first**):

=TRIM(LEFT(RIGHT(SUBSTITUTE(“-/”&A1,”-/”,REPT(” “,99)),A2*99),99))

The result is in reversed order: 1 means the last item

Formula 3 is developed by Rich Rothstein.

The post SUBSTITUTE function: Basic and Advanced Examples appeared first on Excel First.

]]>The post Working with Excel Functions and Formulas appeared first on Excel First.

]]>1. Excel Intellisense: Formula AutoComplete

2. Working with Insert Excel Functions Wizard

3. Debug Complex Formulas: The Magic F9 and Ctrl+Z

4. Display items using display triggers

This is intended to be a short guide to help you build and debug your own formulas.

First thing to know is that there is a major difference between excel functions and excel formulas:

Excel Functions are built into Excel and their functionality and arguments cannot be modified by users. An example of excel functions: SUM, COUNTIF, ROW, COLUMN, INDEX, MATCH, VLOOKUP, and so on.

An Excel Formula is designed by the user and it can contain multiple Excel Functions, Defined Names, Constants, Range references.

Length of formula contents: 8,192 characters

Internal length of formula: 16,384 bytes

Iterations: 32767

Worksheet arrays: Limited by available memory

Selected ranges: 2048

Arguments in a function: 255

Nested levels of functions: 64

Note: For more about Excel specifications and limits see: https://support.office.com/

When you start typing in a cell one of these 3 signs: the equal sign: “=”, the plus sign: “+”, or the minus sign: “-“, excel Function AutoComplete Intellisense is activated, any letters you type after will bring you the list of Excel Function that starts with that letter. If you continue to type more letters, the list will shrink to display only the ones that match to what you typed. (if you don’t want to see the list, you can always click the Escape key and continue, or just ignore it).

You can click once on any Function from the short list, Excel Intellisense will display a short description for that function (Tool Tips):

If you double click any function from list, Excel will insert the function in your formula, and automatically display the list of arguments for that function:

More on Formula AutoComplete on section 4: Display items using display triggers

Another good thing that might be useful to know is that both the function description and the list of function arguments rectangles are movable, you can drag them anywhere you want, just hover the mouse over the rectangle sides and the pointer will change to a quad arrow symbol; when you see the crossed arrows, just click and drag.

You can start writing a new formula by pressing the Insert Function button, from the Formulas Tab in Ribbon, or from the shortcut next to the Formula bar, as in the image below:

This action will open the Insert Function Wizard:

Insert Function Wizard

After you select a function and click ok, the Function Arguments window (see below image) will show up, with more useful information, like: argument data type, argument short description, formula result and a link to the Help section, with more details and examples for that function.

Again, Excel Intellisense will be very helpful, especially when you are dealing with a long and complex formula.Here is a video example:

To quickly identify which part of the formula failed, click after the first open paranthesis of the function to view the function arguments in tool tips, then click the logical argument link to select the entire argument, and click the F9 key to calculate only that argument. This action will replace the argument with its calculated value, you have to press Ctrl+Z to return to your formula or reference. For the example function, the steps to debug are :

1. Click in formula bar click after the first open paranthesis of the function;

2. Click the tooltips link to select the first argument (logical_test)

3. Press F9, the result should be TRUE or FALSE, Press Ctrl+Z to restore the argument. In this case, the result for this argument is TRUE.

4. We know from the previous step that the logical test returns TRUE, click now on the tooltip link to select the value_if_true argument. Pressing the F9 key will return an error for this argument, we have to evaluate all the functions used in this argument, to see which one returns an error. Remember to press CTRL+Z after each use of F9 key!

5. inside the value_if_true argument, we have another formula: IF(AND(B82>=12001,C82>2250),””Yes””,””No””)”

Repeat the above steps for each function used in this argument formula, select each argument one by one, press F9 to see its calculated value, then return with Ctrl+Z after each F9 key pressed.

For this example, the error is obvious, no debug is really needed, but with large data sets and multiple nested functions, it’s an easy way to understand what’s wrong there…

**4. Formula AutoComplete: Display items using display triggers.**

Remember that the AutoComplete feature will not be active if the first character in the cell is not one of the following:

– the equal sign: “=”

– the plus sign: “+”,

– or the minus sign: “-”

Display triggers for Excel Functions, Defined Names and Defined Table names:

– type one or more beginning letters, excel will display the items that starts with those letters, in alphabetical order.

For Function arguments, there are no display triggers!

Only a few Excel functions have arguments with enumerated constants that will be displayed automatically in list: CELL, FV, HLOOKUP, MATCH, PMT, PV, RANK, SUBTOTAL, VLOOKUP and AGGREGATE in newer versions of Excel.

Display triggers for Defined Tables special items: Headers, Totals, ThisRow, All, Data.

There are 3 display triggers for table components:

– the opening bracket: “[” , used after the table name: =Table1[

– the comma: “,” used after a table component: =Table1[[#All],

– or the colon sign: “:” (also known as the Range Operator), used after a column name: =Table1[[Column1]:

The post Working with Excel Functions and Formulas appeared first on Excel First.

]]>The post Can’t Open Pivot Table Source file appeared first on Excel First.

]]>Like a good Excel fan, I switched to Excel 2016 to try the new version.

While working on a Dashboard for a client, with a lot of Pivot Tables and charts in it, at some point, **after moving some pivot tables and charts into other sheets, within the same workbook**, I received this unexpected error message – Can’t Open Pivot Table Source:

I never saw this error before, and I have a 20 years experience in working with Excel. Apparently, the pivot table cannot be Refreshed, because the Data Source reference is not relative anymore, it contains the file name too:

Before moving pivot tables and charts:

After moving a pivot table or a chart, the reference contains the file name:

And this is just the beginning…

The file is unusable, any time a user changes the name, the pivot table will fail to refresh.

- manually removing the file name from the Data Source reference in all pivot tables had no effect, the problem still comes back;
- even if I used a code to change the data source for all pivot tables, and then removed duplicate Pivot Caches, the file keeps changing the source reference to absolute.

The problem, which is an Excel bug after my opinion, will appear under these circumstances:

- the excel file was received from another person, and it was created in a previous version of excel, this is one of the cases when the option from Excel Options-Trust Center-Privacy Options: “Remove personal information from file properties on save” is checked.
- the file contains a pivot table, with or without a pivot chart.
- the pivot chart, or the pivot table, (or both), is moved into another sheet (the chart with cut-paste, pivot with the option-Move Pivot Table)

**The bug is caused by the Document Inspector…**

Jon Peltier wrote an article about this problem, way back in 2010 and provided a workaround developed by Bill Manville, which basically consists in:

- Make a copy of the worksheet with the old pivot table and pivot chart in a different workbook;
- Move the copied worksheet back into the original workbook;
- Change the new chart’s source data to the new pivot table;
- Change the pivot table’s data source to the new range;
- Refresh the pivot table.

What if you have a large number of pivot tables and charts? You will have to work hard to make all these steps for each pivot table and for each chart…

In previous versions of Microsoft Office, files created in Microsoft Office Excel, Microsoft Office PowerPoint, and Microsoft Office Word were saved in a proprietary, single file format; they were known as *binary* files.

The Office Open XML Formats are based on XML and ZIP archive technologies. However, unlike legacy files, Office Open XML Formats files can be opened to reveal component parts that give you access to the structures that compose the file.

To view the structure of the excel file, you can change the file extension from .xlsx to .zip (ignore the warning message) and simply double click the file to open it; don’t forget to change back the extension to .xlsx after you finish editing the file.

Or, you can right click the excel file, and **Open With **WinRaR, WinZip, 7Zip or any other archive software.

**The key** is in the excel archive: if you right click the excel file, and open it with an archiver, this is our guilty folder:

**xl\pivotCache\_rels** , the problem is related to pivot cache relationships…

Inside this folder, there should be at least 1 file, named: pivotCacheDefinition1.xml.rels

If there are multiple caches, the rest of the files will be: pivotCacheDefinition2.xml.rels, pivotCacheDefinition3.xml.rels and so on.

The normal content of this file should look like this:

In the broken file, the Pivot Cache Definition will look like this:

As you can easily notice, Excel added a new relationship, even there are no external links in the file:

http://schemas.microsoft.com/office/2006/relationships/xlExternalLinkPath/xlPathMissing

Now, when you open the renamed file, you might get an error message saying that “Data Connections are disabled”, even there there is no external connection.

It’s a mistery why Excel considers that we have external content and adds a xlExternalLinkPath/xlPathMissing relationship, and which is the connection with the Document Inspector.

If you look in the archive, in xl\pivotCache folder, there are 2 files:pivotCacheDefinition1.xml and pivotCacheRecords1.xml.

The pivotCacheDefinition1.xml will contain the following expression (note the relationship ID in red):

<worksheetSource name=”DataTable” r:id=”rId2″/>

The red part will never be found in a normal file, the normal value should be:

<worksheetSource name=”DataTable”/>

Warning: Please apply these steps on a copy of your workbook, in some circumstances you can corrupt the workbook and it cannot be repaired! (as I said it’s mostly a hack)

Open the file in excel, uncheck the option from Excel Options-Trust Center-Privacy Options: “Remove personal information from file properties on save”, then **save and close the file**.

Open the excel archive with an archiver, and go to xl\pivotCache\_rels folder.

From the pivotCacheDefinition1.xml.rels file (and from all other pivotCache Definition files), simply delete the red part, but **ONLY** the red part, otherwise excel will not be able to open it, it will become corrupted:

Save the changes and close the file.

Open the excel workbook.

All pivot tables data source will have this weird looking reference: !DataTable . Note that the reference to the file name is missing, but there still is an exclamation mark.

**All you have to do** is to click the** SAVE** button and **close** the file! Now, when you open the file, the bug is gone forever…

The relationship ID from pivotCacheDefinition1.xml will not contain the wrong relationship ID r:id=”rId2″, excel took care of that itself, and rewrote the pivotCacheDefinition1.xml.rels.

If the option from Excel Options-Trust Center-Privacy Options: “Remove personal information from file properties on save” is unchecked, the pivot chart and pivot tables can be moved, the bug will not appear.

Excel will check this option automatically if the file was created in a previous version, or if you use the Document Inspector to remove personal information, the next time you open the Privacy Options you will notice that the option is checked, even if it was not checked before using the Document Inspector. If the option is greyed, you can only activate it if you use the Document Inspector.

**Users should do this on a copy of their file**, it’s not bullet proof, if they make a mistake, they can corrupt the file irreversibly, excel will open with attempts to repair the corrupted file.

Or, you can download the file below and apply the above steps to fix it, to make sure you understand the process, even if it’s fairly simple:

**Functional Pivot Table – Broken.xlsx**

As a conclusion, I hope that Microsoft engineers will fix this bug, from what I’ve seen, there are many users with this problem, I even found an old topic started in 2013, with no functional solution: data-source-path-in-pivot-table-changes-to-absolute-on-its-own

As mentioned above, another way to solve this absolute reference problem is to copy the data source data sheet and the sheets with pivot tables and charts into a new “clean” workbook, and to change the data sources for all pivot tables to the data source from the new workbook, this solution is more accessible to most users.

If the workbook is too complex to move all the sheets into a new book, then hacking the archive is the way to fix the current workbook.

It is an extreme solution, but it was the only one that worked for me, without the need to manually move the sheets and reconstruct the entire workbook.

If this solution worked for you, please share this information

Cheers,

Catalin

The post Can’t Open Pivot Table Source file appeared first on Excel First.

]]>The post Working With a Defined Name appeared first on Excel First.

]]>

In Excel, you have the option to assign a Name to a cell, or to a Range of cells. This name is reffered to as a Defined Name.

A Defined Name will give more flexibility than before, you can refer to it in your formulas, or chart series.

Also, the name can be located anywhere in your workbook, you don’t need to use cell or range references.

you have multiple ways:

- you can simply right click the cell or the range and select Define Name from the list:

This action will bring up the New Name Dialog Box:

All you have to do now is to type a relevant name to your chosen range into the “Name:” field and click the OK button.

- Or, you can choose Define Name from the Ribbon, from Formulas tab, the Defined Names group:

This action will open the same New Name Dialog Box you’ve seen above: Add New Name

- Another way to create a Defined Name is to select the range, then simply type into the Name Box the name of your selected range. The Name Box is located to the left of the Formula Bar:

Note: This method will create a name scoped to the workbook level! (also known as global name)

All Defined Names have a scope, the scope can be:

- a specific worksheet (a local name, defined at worksheet level)
- the entire workbook (a workbook name, defined at workbook level).

If you create a Defined Name at worksheet level, you will not be able to use it in other worksheet, unless you provide a qualified reference (the worksheet name needs to be typed before the Defined Name):

=SUMPRODUCT(**‘Sales’!Units_Sold***Price_Per_unit)

All you have to do is to open the Name Manager, which is located in the same Formulas Tab, Defined Names group:

Select the name from the list and click the Edit button, or simply double click the name.

The following list of rules is not absolutely necessary to know, but it may be useful to avoid errors when creating new names:

**Always make sure th**he first character of a name is a letter, an underscore character (_), or a backslash (\). Never start with a number.**at t****Avoid names tha**. Keep in mind that the names are case insensitive, Excel will not make a difference between**t have the same structure as**Cell references: AB2355 is not a valid name, for example**TotalSales**and**totalsales****Do not use Spaces****, always use an underscore charact****er (_) or a period character (****.**)**as a word delimiter! Or, just start the name with up****er ca****se****letters, like:****TotalSales**- A name can contain up to 255 characters. For me, is far more than necessary, I prefer short and meaningful names

If your formulas are using cell references instead of Defined Names references, you can replace the cell references with the corresponding Defined Names very easy:

From Formulas Tab, Defined Names group, expand the Dropdown from Define Name button, and click on **Apply Names.** If the formula contains a range reference which has a Defined Name, the range from the formula will be replaced with the name.

For example, if the Defined Name: Units_Sold refers to range D1:D10, and you have a formula in your worksheet referring to the same range of cells:

=SUMPRODUCT($D$1:$D$10*Price_Per_unit), clicking on Apply Names will change the formula to:=SUMPRODUCT(Units_Sold*Price_Per_unit)

The post Working With a Defined Name appeared first on Excel First.

]]>The post Selecting Excel Table Components appeared first on Excel First.

]]>- Headers Row
- Data Body Range
- Totals Row

To select the entire Excel Defined Table, you have to go to the upper – left cell of the Defined Table, and place your cursor over the top – left corner of that cell, Excel will display the Selection Arrow instead of the usual cursor icon:

You should remember this Selection Arrow, it’s the same arrow used for selecting entire worksheet rows or columns.

Click once to select the Data Body Range of the table, if you click again, Excel will select the entire Defined Table, including the Headers Row and the Totals Row.

To select the entire table, another alternative is to select any cell within the table, and press CTRL+A keys once, to select the Data Body Range. Pressing CTRL+A again will select the entire table, including the Headers Row and the Totals Row.

Take a look at the video below, this will replace 1000 words (or at least 500… ) :

I consider this to be the a tricky task…

Mostly, because it’s not as intuitive as it seems, especially when you intend to select multiple columns including the Headers Row and the Totals Row.

Allow me to explain:

To select multiple columns, **ONLY the Data Body Range**, you have to perform these steps:

**select the ENTIRE first column, including the Header Cell**- Click and hold the mouse button when the selection arrow appears, then
- Drag the cursor across all needed columns.

To select multiple columns, **INCLUDING Totals Row and the Header Cell**, you have to perform these steps:

- select
**ONLY the Data Body Range**of the first column, - Click and hold the mouse button when the selection arrow appears, then
- Drag the cursor across all needed columns.

In conclusion, if you want to select **only the Data Body Range** of multiple columns, you have to select the **entire** first column then click and drag…

But if you want to select **entire** multiple columns, you have to select **only the Data Body Range** of the first column then click and drag…

Sounds twisted to me, but this happens because when you execute the click and drag method, Excel will switch your selection. How does this sound to you?

Enjoy

Catalin

The post Selecting Excel Table Components appeared first on Excel First.

]]>Of course, Excel will respect all mathematical rules you learned in school, there are only a few more Operators in Excel: the Range Operators, single Space Operator, Union Operator, the Concatenation Operator and the Exponentiation Operator.

The post Order of Precedence appeared first on Excel First.

]]>Of course, Excel will respect all mathematical rules you learned in school, there are only a few more Operators in Excel: the Range Operators, single Space Operator, Union Operator, the Concatenation Operator and the Exponentiation Operator.

The following table is a complete list of the Order of Precedence used by Excel:

Operator | Description | Order of Precedence |

: (colon)
(single space) , (comma) |
Range operator
Intersection operator Union operator |
1st |

– | Negation operator (as in –1) | 2nd |

% | Percent operator | 3rd |

^ | Exponentiation operator | 4th |

* and / | Multiplication and division operators | 5th |

+ and – | Addition and subtraction operators | 6th |

& | Connects two strings of text (concatenation) | 7th |

=, <, >, <=, >=, <> | Comparison operators | 8th |

If your formula contains operators with the same Precedence Operator — for example, if a formula contains the GTE operator (Greater Than or Equal To: “>=” ) and the LTE operator (Lower Than or Equal To: “<=” ) , Excel will evaluate the operators** from left to right.**

Just to give you a small example, =10/2/5 will give you the same result as: =10/(2*5), because in the first example, we have 2 Division Operators, and in this case Excel will evaluate the formula from left to right: =10/2/5=5/5 = 1. In the second version, excel will calculate the parantheses first: =10/(2*5)=10/10=1. Notice that Excel will respect the Order of Precedence inside parantheses too, in this example: =(2*3+20), 2*3 will be calculated first, then 20 will be added to the result.

To control the order of calculation, include that term between parantheses, this way you will gain control over excel formulas. When you are using multiple nested sets of parantheses, Excel will calculate the parantheses from inside out.

For example: **=10*(20-(3*3) *2)** will calculate first the innermost set of parantheses: (3*3). Here are the steps followed by Excel to perform this calculation:

=10*(20-9 *2) – Excel will calculate first the (3*3) parantheses

=10*(20-18)- the multiplication **9*2** will be processed first;

=10*2 – the term in parantheses is calculated first: **20-18**

20

Be carefull with parantheses though… One of the most common mistakes made when using parantheses in formulas is to open multiple paranthesis but not closing them all.

When you do this, Excel will display an error message, and offers to solve the problem for you. The problem is that usually Excel will place the closing paranthesis at the end of the formula, and this may lead to wrong results. It is you that should decide where the closing paranthesis should be, not Excel.

If you haven’t subscribed yet, please do so, you will be notified each time a new post is published, there are many interesting things to discover.

Have fun

Cheers, Catalin

The post Order of Precedence appeared first on Excel First.

]]>To create a Defined Table, select the data range, or simply select any cell within the data range, and click the Table button from the Insert tab from Ribbon. The shortcut key is Ctrl+T to create a Defined Table.

The post Excel Table Components appeared first on Excel First.

]]>An Excel Defined Table is a special object in Excel which adds a lot of new options and functionalities when working with data ranges. With Defined Tables, you can manipulate data more easily than before, adding power and flexibility to your applications.

To create a Defined Table, select the data range, or simply select any cell within the data range, and click the Table button from the Insert tab from Ribbon. The keyboard shortcut key is Ctrl+T to create a Defined Table.

The formatted data ranges looks identically, but only the right range is a Defined Table. The easiest way to see if there is a Defined Table object inserted into a worksheet, is to check the Name Manager to see if there are any Table Names listed (the Table icon is different from a regular Name icon, see image above), or you can click to select any cell within the data range, if that cell is part of a Defined Table, Excel will open the Table Tools tab in Ribbon.

- Headers Row
- Data Body Range
- Totals Row
- Sizing Handle

The Headers Row contains the Column Names. If your data does not have headers, Excel will automatically create a Header Row with default Column Names like: Column 1, Column 2, and so on. There can be only one Header Row, merged cells are not allowed in Defined Tables.

The Data Body Range contains all your data, excluding the Headers Row and the Totals Row:

The Totals Row contains drop downs for each column, each dropdown will allow you to select from various formulas to display the desired result.

The Sizing Handle is a small triangle on the bottom right side of the Defined Table:

The Sizing Handle will allow you to manually resize the Defined Table, you can increase or reduce the number of rows **OR** columns.

Note that you cannot resize a Defined Table to **add more rows and columns in the same time**, you need to perform 2 different resizing operations for that.

There are many advantages, including (but not limited to) :

- You can easily select Table components, with a single click
- Easy Formatting: In Table Tools tab from Ribbon, you will find many Design Styles for Tables, you can configure your own personal style.
- Easy sorting and filtering, each column Header has a drop down menu which allows you to sort and filter data to see only what you want.
- Formulas are easier to understand, Excel will automatically include named references in your formulas (also known as structured references)
- Excel will auto – fill formulas for the entire column whenever you insert new rows, no need to manually update formulas for new rows.
- An Excel Defined Table is a dynamic source for your charts, pivot tables and formulas, there is no need to adjust the data source if you add new rows or columns to the Table.

In the next lesson, I will show you how to work with Excel Defined Tables, to select Table Components.

Enjoy,

Catalin

The post Excel Table Components appeared first on Excel First.

]]>The post Excel Reference Operators appeared first on Excel First.

]]>-
**“:” (colon)**is the**Range operator**, which produces one reference to all the cells between two cells references, including the cells written in the reference text, like: A11:A13 **“,” (comma)**is the**Union operator**, which combines multiple Ranges into one reference, like A11:A13 , A11:C11 , A11 (you can refer to simple cells too, not only to ranges with multiple cells)**” ” (space)**is the**Intersection operator**, which returns a reference to the cell or to the range of cells found at the intersection of the ranges. In this example, only cell A11 is found in both ranges: A11:A13 A11:C11

Because only practicing the methods described in this article will consolidate your knowledge, you can download a sample workbook to play with the methods described in this article.

**Download Sample File: Excel Reference Operators.xlsx**

Before diving into details, let me clarify a few terms used in this article:

– A **Range **can contain one or more worksheet cells. A range can be a **contiguous** range, when all the cells are contained in a rectangle. A **non – contiguous** Range will contain multiple rectangles, even single cells.

**Contiguous range** sample reference: A10:D18 (refer to the image below)

**Non – Contiguous range** sample reference: G10:G15, I10:I12, K14:L18, I17, G21:J22 (this reference contains 5 ranges, combined using the Union Operator – “,” , refer to the image below)

– A **reference **can contain one or more **cells or ranges**, contiguous or non – contiguous, separated by any of the 3 Reference Operators. Here are some examples of references:

- Reference sample 1: A11:A13 , A11:C11 , A11 (this reference contains 3 ranges, combined using the Union Operator – “,”)

- Reference sample 2: A12 A11:A14 (this reference contains 2 ranges, combined using the Intersection Operator – ” ” (space) )
- Reference sample 3: A12

The Reference Operators are **most often used in Excel Functions**, but you can use them to select ranges, by typing the references in the **Name Box**, which is located under Excel’s Ribbon, to the left of the Formula Bar.

**Name Box Location image:**

You can use the Name Box to select cells or ranges, even if they are in different sheets. If you want to select a range from another sheet, simply type into the Name Box the worksheet name followed by an exclamation mark before the range reference: Sheet1!A1:A20.

**Important**: if the worksheet name contains spaces, you have to wrap the worksheet name between single quotes (or apostrophies) when you want to use this reference to select a range using the Name Box, or in a formula:

**‘**My Sheet**‘!**A1

Excel Intellisense will assist you only when building formulas, to provide function lists and arguments, or to create the references, but not when using the Name Box.

Let’s take a closer look at **how we can use the Reference Operators** to select ranges using the Name Box or in formulas:

The most simple use of the Range Operator is to select a range of cells between (and including) 2 cell references:

**A11:A14**

Most likely, you already knew this. Less known is the fact that you can use the colon multiple times in a reference. Please type the following text in the Name Box, you’ll see what i mean:

A11:A13:C14

By default, Excel will select all the cells from the first cell reference (A11) and the last cell reference (C14) in the range. In other words, Excel will create and select a **contiguous** range with these cells as rectangle corners: A11, C11, A14, C14. This might not be what you expected, and you should **avoid using multiple colon ranges** in your formulas, otherwise you might get unexpected results if you are not aware of this default behavior. If you have a useful way to use multiple colon ranges, please let me know, I am very curious

**The Union Operator: “,” – (comma)**

If used in the Name Box, all the ranges you typed in, separated by commas, will be selected:

A11:A14 , A11:C11

The only limit on how many ranges you can type into the Name Box is the 255 characters limit, so it’s quite enough, assuming that you will not type more than a few ranges, contiguous or non – contiguous:

A11:A12 , A14 , C12:C13 , B12

Take a look at the following image:

When you type A11:A14,A11:C11 into the Name Box, because the A11:A14 , A11:C11 ranges have a common cell – A11, knowing that a cell cannot be selected twice, you will see that the Excel Status Bar shows a count of 6 selected cells. If you use the very same reference in a simple SUM formula: =SUM(A11:A14,A11:C11), Excel will add the values from each duplicate reference! (make sure the formula is not applied in a cell within the formula reference, to avoid circular references)

**The Intersection Operator: ” ” – (space)**

If you type into the Name Box this reference:

A11:A14 A11:C11

Excel will select only the common cells, which in this case is A11.

If there are no common cells within the ranges you typed into the Name Box, Excel will display this error message:

If the ranges that you specified in a formula do not intersect, the formula returns a #NULL! error. For example, the ranges in the formula **=SUM(A11:A14 B11:C11)** do not intersect, so the formula returns a #NULL! error.

As you already know by now, you can type a reference containing multiple ranges separated only by spaces into the Name Box or into a formula, to create an Intersection between 3 ranges:

A11:A14 A11:C11 A11:B12

The only problem when using the Intersection Operator with multiple ranges, is that you have to keep in mind that **ALL** ranges must intersect! In other words, all ranges must have **at least one common cell, **otherwise you will get the #NULL! error if you use the ranges in a formula, or the Reference error message as shown in the above image, if the reference is typed into the Name Box.

General Rules for using Reference Operators in Name Box or in formulas:

- You can use spaces between references, Excel is able to identify the Reference Operator! For example the reference:

A11:A14 , A11:C11 , A10:B12

has at least 2 spaces before and after the commas. Knowing that the **” “** (**space)** character is the Intersection Operator and the **“,” (comma)** character is the Union Operator, you might expect Excel to be confused when you use a space followed by a Range Operator or a Union Operator. The key is that, if there are only spaces with no other Reference Operators (Range Operator – “:”, Union Operator – “,”), only then will Excel treat the references as Intersections.

If Excel finds a Range Operator – “:” or a Union Operator – “,”), even if you have multiple spaces between ranges Excel will treat the references as Ranges, if Range Operator (“:”) is used, or as combined Ranges if Union Operator (“,”) is used.

Only when you have one or multiple spaces between ranges, like:

A11:A14 A11:C11

only then will Excel treat the reference as an Intersection between 2 or multiple ranges.

- You can combine 2 or all 3 Reference Operators to create a reference:

A13:A14 , A11:A14 A11:C11

The above range reference typed into the Name Box can be read as: “the range A13:A14 **AND** the intersection between ranges A11:A14 A11:C11″. Because the intersection between ranges A11:A14 A11:C11 will be only cell A11, Excel will select only 3 cells: A13, A14, **AND** A11.

Have fun

Catalin

The post Excel Reference Operators appeared first on Excel First.

]]>