TABLE OF CONTENTS (HIDE)

Power User Tips and Tricks

Word and Excel

Word

Find, Replace and Goto for Texts, Graphics, format and Others

References
  1. "Find and replace text and other data in a Word document" @ https://support.office.com/en-us/article/find-and-replace-text-and-other-data-in-a-word-document-c6728c16-469e-43cd-afe4-7708c6c779b7.
  2. "Finding and replacing characters using wildcards" @ https://wordmvp.com/FAQs/General/UsingWildcards.htm.
Find, Replace and Goto and their shortcut keys
  Shortcut Key Functions
Find Ctrl-F Find texts (in "Navigation" pane)
Replace Ctrl-H Find and replace texts
Click "More" to show the "Search Options", such as "Match case", "Find whole words only", "Use wildcards" and etc.
"Use wildcards" support regular expression (regex).
Goto Ctrl-G Similar to "Find", but allow you to search non-text objects such as graphics, headings, fields, equations, and etc.
Find/Replace Patterns and Special Characters using Caret Codes ^code

Word allows you to find/replace text patterns using codes in the form of ^code. These codes are unique to Word.

To check these codes: Ctrl-H ⇒ "Replace" tab ⇒ Position your cursor inside the "Find what" or "Replace with" field ⇒ More ⇒ Special ⇒ choose the desire item to generate the ^code.

These codes can be used in "Find what" and "Replace with" fields:

  • ^p (Parallel Mark or Newline)(or ^13); ^l (Manual Line Break)(or ^11); ^t (Tab)(or ^9)
  • ^^ (Caret - to resolve ambiguity)
  • ^w (White Space - space or tab)
  • ^nnn (ASCII character in decimal), ^0nnn (ANSI character)

These codes can be used in "Find with":

  • ^? (Any Character); ^# (Any Digit); ^$ (Any Letter)
  • ^g (Graphics)

You can use these codes in the "Replace with" field:

  • ^& ("Find What" result text)
  • ^c (Clipboard Content)

For examples:

  1. "Find what" code: ^#^#%
    "Find what" meaning: two digits followed by %.
    "Replace with" code: --^&--
    Choose "Replace" or "Replace All"
    Result: Enclose (next or all) two-digit percent by -- and --.
  2. [TODO]
Find/Replace with Regular Expression (Regex) or Wildcards

Word supports find/replace with it own variation of regular expressions (regex), which is called wildcards.

To use regex: Ctrl-H (Find/Replace) ⇒ Check "Use wildcards" option under "More".

Read "Regular Expression (Regex)" for the syntax of Regex. Word supports regex in its own unique way!

A regex is a pattern matching a set of text strings. An elementary regex pattern matches a single character, as follows:

  • Any letter, digit and most of the special characters matches itself. For example, a match a; 9 matches 9; % matches %. In word, the matching is case sensitive, i.e., x matches x but not X. Take note that Word supports Unicode characters in search too.
  • These special characters have a special meaning: [ ] { } < > ( ) - @ ? ! * \. To match these characters, prepend with the escape character \. For example, \< matches <; \@ matches @.
  • ^nnn: match the ASCII character having decimal number nnn. For example, ^13 matches newline; ^9 matches tab; ^65 matches A; ^97 matches a. This is not standard regex.

A regex for matching a text string (a sequence of characters) consists of a sequence of sub-patterns (or sub-expressions) , e.g., xyz matches xyz; 12345 matches 12345; \<p\> matches <p>.

You can use these wildcards in matching:

  • ?: matches any single character, including space and punctuation characters. For example, ab?de matches abade, abbde, abXde, etc. (This is not a standard regex and is unique to Word. Standard regex uses dot (.) which matches any single character other than newline).
  • *: matches any sequence of characters, including space and special characters. For example, a*t matches art, aXXt, a@^@t, a t, etc. (This is not a standard regex, which uses .*)
  • [ ]: matches one (single) of the characters enclosed (i.e., OR), e.g., [aeiou] matches a, e, i, o or u.
  • [ - ]: matches any single character in this range, e.g., [a-z] matches any (single) lowercase letter; [a-z0-9] matches any (single) lowercase letter or digit.
  • [! ]: NOT one of the characters enclosed. For example, [!aeiou] matches any (single) character other than a, e, i, o or u. (This is not standard regex, which uses caret (^).)
  • {n}, {m,n}, {n,}: occurrence indicators for n, m-to-n, and n-or-more occurrences. For example, abc{2} matches abcabc; ab{2-3} matches abab or ababab.
  • @: occurrence indicators for one or more occurrences, same as {1,}. For example, abc@de matches abcde, abcabdde, abcabcabcde, etc. (Standard regex uses +. Word does not support * (zero or more), ? (zero or one) used in standard regex. Word also does not support {0,} and {0,1} which is probably a bug?!?!).
  • <, >: Positional Anchors matching the beginning or ending of a word boundary. For example, <pre matches any word beginning with pre; <apple> matches the word apple; ing> matches any word ending with ing.
  • ( ): Parenthese can be used for two purposes:
    1. Grouping sub-patterns: e.g., (abc){2} matches abcabc, but abc{2} matches abcc.
    2. back references: They have no effect in "find" but divide the match result into sub-matches, identified as \1, \2, \3, etc, where \1 is the matched content of the first set of parentheses. For example, <*> <*> matches two words separated by a space without back references. You can set back references using parenthese in this form (<*>) (<*>) to "mark" the two matched words. You can refer to the resultant content of the first matched word as \1, and second word as \2. See more example below.
  • Word uses "lazy" matching, i.e., it quits matching as soon as the shortest match is found. For examples, xy{2,4} tries to match xyy, then xyyy, and then xyyyy in lazy matching. On the other hand, most Unix tools and programming languages use "greedy" matching to get the longest match.

For examples:

  1. Objective: Swap two words
    "Find what" regex: (<*>) (<*>)
    "Find what" meaning: two complete words separated by a space, marked by two parenthesized back references \1 and \2.
    "Replace with" regex: \2 \1
    "Replace with" meaning: \1, \2 denoted the first and second matched back references.
    Choose "Replace" (next 2 words) or "Replace All" (all two consecutive words).
  2. "Find what" regex: ([! ]@)^13
    "Find what" meaning: one or more non-space before the paragraph mark - matches the last word or partial word at the end of the paragraph marked by parenthezied back reference \1. This is slightly different from (<*>)^13, which matches a complete word at the end of the paragraph.
  3. Objective: Transposing date from the form "28th March 2018" to the form "March 28, 2018"
    "Find what" regex: ([0-9]{1,2})([dhnrst]{2}) (<[ADFJMNOS]*>) ([0-9]{4})
    "Replace with" regex: \3 \1, \4
  4. Objective: Transposing date from the form "28/03/2018" to "2018/03/28"
    "Find what" regex: ([0-9]{1,2})/([0-9]{1,2})/([0-9]{4})
    "Replace with": \3/\1/\2
  5. Objective: Remove empty rows
    "Find what" regex: (^13)\1@
    "Find what" meaning: Two or more consecutive paragraph marks. Take note that you can use back references in "Find with".
    "Replace with" regex: ^p
    "Replace with" meaning: In word, you can use ^p in "Replace with", but NOT in "Find what". You need to use ^13 in "Find what".
Find Images, Table, Comments and Other Objects

Press Ctrl-F to show the "Navigation" pane ⇒ Click the down arrow in "Search document" ⇒ You can choose "Graphics", "Tables", "Equations", "Footnotes/Endnotes", or "Comments".

Goto a specific page, table, heading or other item

Ctrl-G (Goto) ⇒ In "Go to what", choose the type of items such as "Graphics", "Tables", "Headings", "Fields", "Equations", "Objects", and etc.

Find/Replace Specific Formatting

Ctrl-H (Find/Replace) ⇒ Find or Replace tab ⇒ More ⇒ Format ⇒ You can choose various formatting such as "Font", "Paragraph", "Style", and etc ⇒ Enter the text (optional).

Style, Template and Formatting

Formatting Tools
  • Format Painter: One of the most useful feature for formatting your word documents. Suppose that you wish to apply the same format of a paragraph or a character to another part of the document. Select the texts, push "Format Painter" (at the leftmost "Home" menu), and paste over the texts to be formatted. This is similar to copy/paste but copying the format instead of texts. The "Format Painter" icon looks like copy too and is usually group together with cut/copy/paste icons.
  • Show Paragraph Mark: To perform advanced formatting and layout, it is important to enable the "Show Paragraph Mark" (Under Home ⇒ Paragraph) to show the paragraph marks and other hidden formatting symbols such as tab, space, manual line break, section break and page break.

Table and Conversion to Excel

[TODO]

Table Formula: You can use formula such as sum for WinWord's table just like excel. Under "Table Tools" ⇒ Layout ⇒ Data ⇒ Fomula. The columns are named a, b, c, ... from left to right. The rows are named 1, 2, 3, ... from top to bottom. The address of the top-left table cell is a1. For example, sum(a1,a5) returns the sum of cell a1 and a5; sum(a1:b3) returns the sum of cells a1, a2, a3, b1, b2 and b3.

Word's Macro

[TODO]

Miscellanous

Selecting Columns of Texts: Hold the "alt" key, you can use mouse to select columns of texts.

Clipboard [TODO]

Excel

Labels

[TODO]

Formulas - Conditional

[TODO]

Formulas - Statistics

[TODO]

Formulas - Financial

[TODO]