Skip to main content

Office Automation and Productivity

This document covers spreadsheet concepts, database usage from an end-user perspective, word processing, presentation software, application integration, and macro basics. Database design and SQL are covered in depth in programming-and-databases.md.


Spreadsheet Concepts

A spreadsheet organises data into a grid of cells, identified by column letters and row numbers (e.g., A1, B5, D12). Each cell can contain a constant value (number, text, date) or a formula that calculates a result.

Cell References

Reference TypeSyntaxBehaviour when copied
RelativeA1Adjusts based on the copy destination (e.g., A1 copied down becomes A2)
Absolute$A$1Remains fixed regardless of where it is copied
Mixed$A1 or A$1Column fixed ($A1) or row fixed (A$1); the other part adjusts
Worked Example: Relative, Absolute, and Mixed References

In cell C2, enter =A2*B2. Copy this formula to C3, C4, C5.

Because the references are relative, they adjust:

C3 gets =A3*B3

C4 gets =A4*B4

C5 gets =A5*B5

This is correct for calculating row-by-row products.

Now suppose B1 contains a tax rate of 0.15, and you want to calculate tax for each row. In D2, enter =C2*$B$1. Copy to D3, D4, D5.

Because $B$1 is absolute:

D3 gets =C3*$B$1

D4 gets =C4*$B$1

D5 gets =C5*$B$1

The tax rate reference stays fixed at B1.

Mixed reference example: $A2 keeps column A fixed when copied horizontally but allows the row to change when copied vertically. A$2 allows the column to change horizontally but keeps row 2 fixed vertically.

Operators in Formulas

Operator CategoryOperatorsPrecedence (high to low)
Reference: (range), , (union), (intersection)Highest
Negation-
Percent%
Exponentiation^
Multiplication / Division*, /
Addition / Subtraction+, -
Concatenation&
Comparison=, <>, <, >, $\le$, $\ge$Lowest

Common Spreadsheet Functions

Mathematical and Statistical Functions

FunctionSyntaxDescriptionExample
SUMSUM(range)Adds all numbers in a range=SUM(A1:A10)
AVERAGEAVERAGE(range)Arithmetic mean of numbers in a range=AVERAGE(B1:B20)
COUNTCOUNT(range)Counts cells containing numbers=COUNT(A1:A50)
COUNTACOUNTA(range)Counts non-empty cells=COUNTA(A1:A50)
COUNTBLANKCOUNTBLANK(range)Counts empty cells=COUNTBLANK(A1:A50)
MAXMAX(range)Largest value in a range=MAX(C1:C100)
MINMIN(range)Smallest value in a range=MIN(C1:C100)
ROUNDROUND(num, digits)Rounds to specified decimal places=ROUND(3.14159, 2) = 3.14
INTINT(num)Rounds down to nearest integer=INT(7.8) = 7
MODMOD(num, divisor)Returns remainder=MOD(10, 3) = 1
ABSABS(num)Absolute value=ABS(-5) = 5
SQRTSQRT(num)Square root=SQRT(16) = 4
POWERPOWER(base, exp)Raises to a power=POWER(2, 3) = 8

Logical Functions

FunctionSyntaxDescription
IFIF(condition, true_val, false_val)Returns one value if condition is true, another if false
ANDAND(cond1, cond2, ...)Returns TRUE if all conditions are true
OROR(cond1, cond2, ...)Returns TRUE if at least one condition is true
NOTNOT(condition)Reverses the logical value
IFERRORIFERROR(value, value_if_error)Returns value_if_error if the formula results in an error
IFSIFS(cond1, val1, cond2, val2, ...)Evaluates multiple conditions in order
Worked Example: Nested IF and IFS for Grade Calculation

Given a score in cell A1, assign a grade:

Using nested IF:

=IF(A1>=90, "A", IF(A1>=80, "B", IF(A1>=70, "C", IF(A1>=60, "D", "F"))))

Using IFS (cleaner):

=IFS(A1>=90, "A", A1>=80, "B", A1>=70, "C", A1>=60, "D", TRUE, "F")

The TRUE at the end acts as a default/catch-all condition.

Lookup Functions

FunctionSyntaxDescription
VLOOKUPVLOOKUP(lookup_value, table_array, col_index, [range_lookup])Searches the first column of a table and returns a value from the specified column
HLOOKUPHLOOKUP(lookup_value, table_array, row_index, [range_lookup])Searches the first row and returns from the specified row
INDEXINDEX(array, row_num, [col_num])Returns the value at a specific position in an array
MATCHMATCH(lookup_value, lookup_array, [match_type])Returns the relative position of a value
XLOOKUPXLOOKUP(lookup, lookup_array, return_array, [if_not_found])Modern replacement for VLOOKUP; more flexible
Worked Example: VLOOKUP

A product price table in E1:F5:

CellE (Product Code)F (Price)
1P00150
2P002120
3P00375
4P004200
5P00595

In cell A1, a user enters a product code (e.g., P003).

To find the price:

=VLOOKUP(A1, $E$1:$F$5, 2, FALSE)

A1 is the lookup value (P003). $E$1:$F$5 is the table (absolute reference). 2 means return the value from the 2nd column (Price). FALSE means exact match.

Result: 75.

Text Functions

FunctionSyntaxDescription
LEFTLEFT(text, num_chars)Extracts characters from the left
RIGHTRIGHT(text, num_chars)Extracts characters from the right
MIDMID(text, start, num)Extracts characters from the middle
LENLEN(text)Returns the length of a string
UPPERUPPER(text)Converts to uppercase
LOWERLOWER(text)Converts to lowercase
TRIMTRIM(text)Removes extra spaces
CONCATENATECONCATENATE(t1, t2)Joins text strings
FINDFIND(search, text)Finds position of substring

Date Functions

FunctionSyntaxDescription
TODAYTODAY()Returns current date
NOWNOW()Returns current date and time
DATEDATE(year, month, day)Creates a date from components
YEARYEAR(date)Extracts year from a date
MONTHMONTH(date)Extracts month
DAYDAY(date)Extracts day
DATEDIFDATEDIF(start, end, unit)Calculates difference between dates

Charts and Graphs

Chart TypeBest Used ForData Characteristics
Column/BarComparing values across categoriesDiscrete categories
LineShowing trends over timeContinuous data, time series
PieShowing proportions of a wholeSingle data series, few slices
ScatterShowing correlation between two variablesPaired numerical data
AreaShowing cumulative trends over timeTime series with volume
ComboDisplaying two data types with different scalesMixed data types

Conditional Formatting

Conditional formatting applies formatting (colours, icons, data bars) to cells based on their values, making patterns and outliers visually apparent.

Rule TypeDescriptionExample
Highlight cellsFormat cells that meet a conditionCells > 100 turn red
Top/Bottom rulesFormat the top or bottom n itemsTop 10 scores highlighted
Data barsIn-cell bar chart showing relative magnitudeSales figures as bar lengths
Colour scalesGradient colours (e.g., red-yellow-green)Low = red, high = green
Icon setsDisplay icons (arrows, traffic lights) based on valueUp arrow for growth, down for decline

Data Validation

Data validation restricts the type of data that can be entered in a cell, preventing data entry errors.

Validation TypeDescriptionExample
Whole numberRestrict to integers within a range0 -- 100 for scores
DecimalRestrict to decimal numbers0.00 -- 9999.99 for prices
ListRestrict to values from a dropdown listYes, No, N/A for a status field
DateRestrict to dates within a rangeBetween 2020-01-01 and 2026-12-31
Text lengthRestrict the number of charactersExactly 8 characters for student ID
CustomUse a formula to define the valid condition=ISNUMBER(A1) to allow only numbers

Sorting and Filtering

Sorting arranges data in ascending or descending order based on one or more columns.

  • Primary sort: main sort criterion (e.g., sort by Last Name).
  • Secondary sort: applied when primary values are equal (e.g., then by First Name).

Filtering displays only rows that meet specified criteria while hiding the rest.

  • AutoFilter: quick filtering on individual columns.
  • Advanced Filter: complex criteria using multiple conditions (AND/OR logic).

Pivot Tables

A pivot table summarises large datasets by grouping, counting, summing, and averaging data across different dimensions.

Key components:

ComponentDescription
RowsCategories for grouping (e.g., product names)
ColumnsSecondary categories (e.g., months)
ValuesThe data being summarised (e.g., SUM of sales)
FiltersApply criteria to the entire pivot table (e.g., year)
Worked Example: Pivot Table Scenario

Raw data: 500 sales records with columns: Date, Product, Region, Salesperson, Amount.

Using a pivot table, you can quickly answer:

  • Total sales by region (Rows = Region, Values = SUM of Amount).
  • Total sales by product and month (Rows = Product, Columns = Month, Values = SUM of Amount).
  • Average sale per salesperson (Rows = Salesperson, Values = AVERAGE of Amount).
  • Top 5 products by total sales (Rows = Product, Values = SUM of Amount, sort descending, filter top 5).

The pivot table performs the grouping and aggregation automatically without requiring formulas or manual sorting.


Database Concepts -- End-User Perspective

Relational database design, ER diagrams, normalisation, and SQL are covered in programming-and-databases.md. This section covers database usage from the perspective of an end-user interacting with a DBMS application (e.g., Microsoft Access).

Database Objects

ObjectDescription
TableStores data in rows (records) and columns (fields)
QueryExtracts, filters, sorts, or summarises data from tables
FormProvides a user-friendly interface for data entry and editing
ReportPresents formatted data for printing or viewing

Tables

A table is the fundamental storage structure. Each table has:

  • Fields (columns): Define the attributes of the data. Each field has a data type (text, number, date, currency, yes/no, etc.).
  • Records (rows): Individual entries in the table.
  • Primary key: A field (or combination of fields) that uniquely identifies each record.
  • Field properties: Define constraints such as field size, required, default value, validation rule, indexed, and input mask.
Field PropertyDescriptionExample
Data typeType of data stored (Text, Number, Date/Time, etc.)Currency for price fields
Field sizeMaximum characters or numeric precision50 for name fields
RequiredWhether a value must be enteredYes for StudentID
Default valueValue automatically entered if none is specified0 for a quantity field
Validation ruleExpression that limits acceptable values>=0 AND <=100 for a score
Input maskTemplate for data entry format0000-0000 for phone numbers
IndexedWhether an index is created for faster searchingYes for fields used in searches

Queries

Queries allow users to extract specific data from one or more tables without writing SQL directly.

Query by Example (QBE): A graphical interface where users specify criteria by filling in a grid.

Query TypeDescription
Select queryRetrieve specific fields and records with filtering
Parameter queryPrompts the user for criteria at runtime
Action queryModify data (Append, Update, Delete, Make-Table)
Crosstab querySummarise data in a matrix (row headers, column headers, values)
CalculationPerform calculations on fields (SUM, AVG, COUNT, etc.)

Forms

Forms provide a structured interface for data entry, viewing, and editing. They improve data accuracy by controlling how users interact with the database.

Form FeatureDescription
Text boxesDisplay or accept data entry for a single field
LabelsDescriptive text identifying fields
ButtonsTrigger actions (save record, navigate, print)
Drop-down listsRestrict input to predefined values (lookup from a table)
Sub-formsDisplay related records from another table (e.g., orders for a customer)
Calculated fieldsDisplay values computed from other fields

Reports

Reports present data in a formatted, printable layout suitable for analysis and distribution.

Report FeatureDescription
GroupingOrganise data by categories (e.g., group by department)
SortingOrder records within groups
Subtotals/totalsCalculate sums, averages, counts at group and report level
Headers/footersReport title, page numbers, dates
Conditional formattingHighlight specific values in the report output
ChartsEmbedded charts for visual data presentation

Relational vs Flat-File Database

FeatureFlat FileRelational Database
StructureSingle table/fileMultiple linked tables
Data redundancyHigh (same data repeated)Low (normalised)
Data integrityDifficult to maintainEnforced by keys and constraints
Query flexibilityLimited (filter/sort)Powerful (SQL, joins, unions)
Concurrent accessTypically single-userMulti-user with locking
ScalabilityPoor for large datasetsScales well
ComplexitySimpleRequires design expertise
ExamplesCSV, single spreadsheetMySQL, PostgreSQL, MS Access

Word Processing and Desktop Publishing

Word Processing Features

FeatureDescriptionUse Case
Text formattingFont, size, bold, italic, underline, colour, highlightingEmphasising text, improving readability
Paragraph formattingAlignment, indentation, line spacing, paragraph spacingStructuring documents
Styles and themesPredefined sets of formatting for consistent appearanceMaintaining document consistency
Headers and footersRepeated content at top/bottom of each pagePage numbers, document title, date
Page layoutMargins, orientation (portrait/landscape), columns, page breaksControlling document appearance
TablesOrganise data in rows and columnsSchedules, comparison charts
Images and graphicsInsert and format pictures, shapes, SmartArtIllustrations, diagrams
Spell and grammar checkAutomated checking of spelling and grammar errorsProofreading
Track changesRecord edits with author attributionCollaborative editing
Mail mergePersonalise documents from a data sourceMass letters, certificates
Table of contentsAuto-generated from heading stylesLong documents, reports
Footnotes/endnotesAnnotations and references at page bottom or document endAcademic writing
Find and replaceSearch for text and optionally replace itBulk editing
TemplatesPre-formatted document layouts for common document typesResumes, invoices, memos

Desktop Publishing (DTP)

DTP software (e.g., Adobe InDesign, Microsoft Publisher) provides advanced layout control for professional publications such as brochures, newsletters, magazines, and books.

FeatureWord ProcessingDesktop Publishing
Primary purposeText-centric documentsVisual layout and design
Typography controlBasic (font, size, spacing)Advanced (kerning, tracking, leading, baseline)
Layout precisionLimitedPixel-perfect placement
Text wrappingBasic (around images)Advanced (custom shapes, contours)
Colour managementBasicCMYK support, spot colours
OutputOffice documents, lettersPrint-ready publications
Master pagesNot availableConsistent page templates
ImpositionNot availableArranging pages for printing

Presentation Software

Presentation software (e.g., Microsoft PowerPoint, Google Slides, Keynote) creates slide-based visual presentations.

Key Features

FeatureDescription
Slide layoutsPredefined arrangements of placeholders for title, content, images
Slide transitionsAnimated effects between slides (fade, push, wipe, morph)
AnimationsEffects applied to objects within a slide (appear, fly in, emphasis)
Master slidesTemplate defining the consistent appearance of all slides
Speaker notesNotes visible only to the presenter (not projected)
MultimediaEmbedded audio, video, and interactive content
HyperlinksLinks to other slides, external URLs, or files
Tables and chartsData visualisation within slides
Drawing toolsShapes, lines, arrows, freehand drawing
Slide show modeFull-screen presentation with keyboard/click navigation

Design Principles for Presentations

PrincipleDescription
SimplicityOne main idea per slide; avoid clutter
ConsistencyUse the same fonts, colours, and layout throughout
ContrastUse contrasting colours for text and background
HierarchyImportant information should be larger and more prominent
ReadabilityFont size at least 24pt for body text; sans-serif fonts for screens
6x6 ruleMaximum 6 bullet points per slide, maximum 6 words per line
Visual over textUse images, charts, and diagrams instead of walls of text
White spaceLeave adequate empty space; do not fill every pixel

Integration Between Applications

Mail Merge

Mail merge combines a main document (template) with a data source to produce personalised documents for each record.

Process:

  1. Main document: Create a template with merge fields (placeholders for variable data).
  2. Data source: Prepare a data file (spreadsheet, database, or CSV) containing the variable data.
  3. Insert merge fields: Map data source fields to placeholders in the template.
  4. Preview and merge: Preview the results, then merge to produce individual documents or a single consolidated document.
ComponentDescriptionExample
Main documentTemplate with fixed text and merge field placeholdersLetter template with <<Name>>, <<Address>>
Data sourceTable of records containing the variable dataExcel sheet with columns: Name, Address, Date
Merge fieldsPlaceholders that are replaced with data source values<<Name>> replaced with "Chan Tai Man"
Merged outputIndividual documents or a single combined document200 personalised letters
Worked Example: Mail Merge for Exam Certificates

A school needs to print certificates for 300 students. Each certificate shows the student name, class, and exam score.

Data source (Excel):

NameClassScore
Chan Tai Man5A92
Lee Siu Ming5B88
Wong Ka Wai5A95

Main document (template):

Certificate of Achievement

This is to certify that <<Name>> of class <<Class>>
has achieved a score of <<Score>> in the DSE ICT examination.

Awarded on <<Date>>

After merge, each student receives a personalised certificate with their name, class, and score filled in. The <<Date>> field can use the current date function.

Embedding vs Linking (OLE)

Object Linking and Embedding (OLE) allows data from one application to be included in another.

AspectEmbeddingLinking
StorageThe object is stored within the destination fileOnly a reference (link) to the source file is stored
File sizeIncreases the destination file sizeMinimal increase (just the link path)
UpdatingChanges to the embedded object do NOT affect the originalChanges to the source file ARE reflected in the destination
PortabilitySelf-contained; works even if the original file is movedBreaks if the source file is moved or deleted
When to useWhen the data should be independent and portableWhen the data should stay synchronised with the source

Example: Embedding an Excel chart into a Word document means the chart data is stored inside the Word file. Linking means the Word document references the Excel file; if the Excel data changes, the chart in Word updates automatically.

Copy and Paste Between Applications

MethodDescriptionData Transferred
Copy/PasteStandard clipboard; data is pasted as static contentFormatted text, images
Paste SpecialChoose the format of pasted dataUnformatted text, image, OLE object
Paste LinkCreates a link to the source; updates dynamicallyLinked OLE object

Common Integration Scenarios

ScenarioSource ApplicationDestination ApplicationIntegration Method
Quarterly report with financial tablesExcelWordEmbed or link chart
Mass personalised lettersExcelWordMail merge
Presentation with live dataExcelPowerPointLink chart
Contact list for email campaignAccess/ExcelEmail clientMail merge
Customer data in a reportDatabaseWordMail merge with query

Macro Basics

What Is a Macro?

A macro is a recorded sequence of actions (keystrokes, mouse clicks, menu selections) that can be played back automatically. Macros automate repetitive tasks, saving time and reducing human error.

Recording a Macro

Most office applications provide a macro recorder that captures user actions and converts them into code.

General steps:

  1. Start the macro recorder and assign a name (and optionally a shortcut key).
  2. Perform the actions you want to automate.
  3. Stop the recorder.
  4. The macro is saved and can be replayed at any time.
Worked Example: Recording a Macro in a Spreadsheet

Task: Format a sales report header -- make row 1 bold, set background to blue, set font colour to white, centre-align, and set column widths.

Steps:

  1. Click "Record Macro" and name it FormatHeader.
  2. Select row 1. Set font to bold. Set background fill to blue. Set font colour to white. Set alignment to centre. Set column widths to 15.
  3. Stop recording.

Now, whenever you open a new sales report, running FormatHeader applies all formatting in one step instead of performing each action manually.

Macro Code (VBA Basics)

Macros recorded in Microsoft Office applications are stored as VBA (Visual Basic for Applications) code. Understanding VBA basics allows users to edit and enhance recorded macros.

Key VBA concepts:

ConceptDescription
VariableA named storage location for a value
Sub/FunctionA named block of code that performs a task
ObjectAn application element (workbook, worksheet, range)
MethodAn action performed on an object (Select, Delete, Copy)
PropertyAn attribute of an object (Value, Font, Color)

Example VBA macro:

Sub HighlightFailingScores()
Dim i As Integer
For i = 2 To 100
If Cells(i, 3).Value < 50 Then
Cells(i, 3).Interior.Color = RGB(255, 0, 0)
End If
Next i
End Sub

This macro iterates through rows 2 to 100, column 3, and colours any cell with a value below 50 in red.

Macro Security Considerations

RiskDescriptionMitigation
Macro virusesMalicious macros embedded in documents that execute when openedDisable macros from untrusted sources
Unintended actionsA poorly written macro may delete or modify dataTest macros on backup data first
PrivacyMacros can access and transmit data without user awarenessReview macro code before running

Modern office applications default to disabling macros from the internet and prompt the user before enabling macros in downloaded documents.


Common Pitfalls

  1. Relative vs absolute references: Forgetting to use $ for absolute references when copying formulas is one of the most common spreadsheet errors. If a formula that should reference a fixed cell (like a tax rate) gives wrong results after copying, check for missing $ signs.

  2. VLOOKUP column index: The column index in VLOOKUP is relative to the table array, NOT the worksheet column. If your table starts in column E and you want the value in column G, the index is 3 (not 7).

  3. VLOOKUP left-to-right only: VLOOKUP can only search the leftmost column of a table. If you need to look up a value and return a result from a column to the left, use INDEX+MATCH or XLOOKUP.

  4. Division by zero in formulas: If a formula divides by a cell that may be empty or zero (e.g., =A1/B1), the result shows #DIV/0!. Use =IFERROR(A1/B1, 0) or =IF(B1=0, 0, A1/B1) to handle this gracefully.

  5. Circular references: A formula that references its own cell (directly or indirectly) creates a circular reference. Most spreadsheets detect this and warn the user. Circular references are rarely intentional and usually indicate an error.

  6. Data validation override: Data validation can be bypassed by pasting data into a cell (paste special or drag-and-drop). For critical data integrity, use database constraints instead of, or in addition to, spreadsheet data validation.

  7. Mail merge data formatting: If the data source has numbers stored as text (or vice versa), the merged output may display incorrectly (e.g., dates showing as serial numbers). Always check data types in the source before merging.

  8. Linking vs embedding trade-off: Linking keeps files synchronised but breaks if the source is moved. Embedding makes files self-contained but increases file size and does not update. Choose based on whether synchronisation or portability is more important for the use case.

  9. Macro security: Never enable macros in documents from untrusted sources. Macro viruses can spread through shared documents and can delete files, install malware, or steal data.

  10. Pivot table data refresh: Pivot tables do not automatically update when source data changes. You must manually refresh the pivot table (or set up automatic refresh) to reflect new or modified data.


Practice Problems

Question 1: Spreadsheet Formulas

A spreadsheet contains the following data:

A (Student)B (Maths)C (English)D (ICT)E (Total)F (Average)G (Grade)
1
2Alice859278
3Bob726588
4Carol908895
5David605570

(a) Write the formula for E2 to calculate the total score for Alice.

(b) Write the formula for F2 to calculate the average score for Alice.

(c) Write the formula for G2 to assign a grade: "A" if average >= 80, "B" if >= 60, otherwise "C".

(d) If the formula in E2 is copied down to E5, what will E3 contain?

Answer:

(a) =SUM(B2:D2)

(b) =AVERAGE(B2:D2) or =E2/3

(c) =IF(F2>=80, "A", IF(F2>=60, "B", "C"))

(d) Because the references in =SUM(B2:D2) are relative, copying to E3 changes them to =SUM(B3:D3), which calculates the total for Bob: 72 + 65 + 88 = 225.

Question 2: VLOOKUP and Conditional Formatting

A product table is in cells H1:I6:

H (Code)I (Price)
1
2A0125
3A0245
4B01120
5B0285
6C01200

In column A (rows 2--20), a list of product codes is entered. Column B should display the corresponding prices.

(a) Write the VLOOKUP formula for cell B2.

(b) Explain what happens if the code in A2 is not found in the product table.

(c) Describe how conditional formatting can be applied to column B to highlight prices greater than 100 in red.

Answer:

(a) =VLOOKUP(A2, $H$2:$I$6, 2, FALSE)

A2 is the lookup value. $H$2:$I$6 is the table range (absolute references so it does not shift when copied down). 2 specifies the second column (Price). FALSE requires an exact match.

(b) If the code is not found, VLOOKUP returns #N/A (Not Available). To handle this gracefully, use =IFERROR(VLOOKUP(A2, $H$2:$I$6, 2, FALSE), "Not Found") to display a custom message instead of an error.

(c) Select the range B2:B20. Go to Conditional Formatting > Highlight Cells Rules > Greater Than. Enter 100 and select red formatting. This applies red fill to any cell in the range where the value exceeds 100.

Question 3: Database Objects

A school uses a database to manage student records. Describe the role of each of the following database objects in this context:

(a) Table

(b) Query

(c) Form

(d) Report

Answer:

(a) Table: Stores the raw data. For example, a Student table with fields StudentID, Name, Class, DateOfBirth. The table is the fundamental data storage structure.

(b) Query: Retrieves specific data from tables based on criteria. For example, a query to list all students in class 5A who scored above 80 in ICT. Queries can also perform calculations (e.g., average score per class).

(c) Form: Provides a user-friendly interface for data entry and editing. For example, a registration form where office staff enter new student details. Forms can include validation (e.g., restricting the Class field to valid class codes) and dropdown lists for consistent data entry.

(d) Report: Presents formatted data for printing or distribution. For example, an end-of-year report card showing each student's scores, class rank, and teacher comments, grouped by class with subtotals and school averages.

Question 4: Application Integration

A company needs to send personalised salary slips to 200 employees. The employee data (name, department, salary, deductions) is stored in an Excel spreadsheet.

(a) Describe how mail merge can be used to produce the salary slips.

(b) Should the employee data table be embedded or linked in the salary slip template? Justify your answer.

(c) Explain two advantages of using macros to automate the salary slip generation process.

Answer:

(a) Steps: (1) Create a salary slip template in Word with merge fields for <<Name>>, <<Department>>, <<Salary>>, <<Deductions>>, and <<Net Pay>>. (2) Set the Excel spreadsheet as the data source. (3) Insert merge fields at the appropriate positions in the template. (4) Preview the merged results. (5) Merge to produce individual salary slips or a single document with page breaks between slips.

(b) Linking is more appropriate because: (1) If employee data changes (e.g., salary adjustment), the linked salary slips will automatically reflect the updated values when refreshed. (2) The Excel file is likely updated monthly, and linking ensures the template always uses the latest data. (3) The template file remains smaller with linking. Embedding would create a static snapshot that would not update when the source data changes.

(c) Two advantages: (1) Consistency: A macro can apply the exact same formatting, layout, and calculations to every salary slip, eliminating variations caused by manual operations. (2) Time saving: Instead of manually configuring mail merge, formatting, and printing for each run, a macro executes all steps with a single command, significantly reducing processing time and human error for 200 employees.

Question 5: Spreadsheet Scenario

A teacher records student attendance in a spreadsheet. Column A has student names (rows 2--31 for 30 students). Columns B to F represent Monday to Friday. Each cell contains "P" (present) or "A" (absent).

(a) Write a formula for cell G2 to count the number of absences for the student in row 2.

(b) Write a formula for cell G2 to calculate the attendance percentage for the student in row 2.

(c) Write a formula using COUNTIF to count how many students were absent on Monday (column B).

(d) The teacher wants to highlight any student with an attendance percentage below 80% in red. Describe how to set this up using conditional formatting.

Answer:

(a) =COUNTIF(B2:F2, "A")

This counts cells in the range B2:F2 that contain "A".

(b) =COUNTIF(B2:F2, "P")/COUNTA(B2:F2)*100 or =(5-COUNTIF(B2:F2, "A"))/5*100

This calculates the percentage of "P" values out of 5 days.

(c) =COUNTIF(B2:B31, "A")

This counts how many cells in column B (rows 2--31) contain "A".

(d) Select the range G2:G31. Go to Conditional Formatting > Highlight Cells Rules > Less Than. Enter 80 and select red formatting. Any cell in column G with a value below 80 will be highlighted in red. Note: the formula in G must calculate a percentage (not just a count) for this to work correctly.