Practical Questions Advanced Spreadsheet
Practical Questions Advanced Spreadsheet
Question 1:
To calculate the "Total Price" based on the conditions you provided, we can break the
task into logical steps. Here’s the step-by-step process:
First, we need to ensure that none of the required values (Quantity Sold, Unit Price, or
Discount) are missing (i.e., null or empty). If any of them are missing, we return
"Invalid Input."
If the "Discount" is greater than 10%, we apply the discount to the total price,
which is calculated as the product of "Quantity Sold" and "Unit Price."
If the "Discount" is less than or equal to 10%, we simply calculate the total price
as the product of "Quantity Sold" and "Unit Price" without any discount.
Step 3: Formula
Using Excel, Google Sheets, or a similar tool, you can use an IF statement to handle
the logic. Below is the step-by-step breakdown of how to construct the formula.
Formula Breakdown
1. Check for Missing Data: First, we’ll check if any of the required fields
("Quantity Sold", "Unit Price", or "Discount") are missing. We’ll use ISBLANK() to
test if any of these fields are empty.
2. Apply Discount Logic: If all values are valid (not missing), we check whether
the discount is greater than 10%. If it is, we apply the discount; otherwise, we
just calculate the product.
3. Construct the Final Formula: Here’s the final formula for Excel or Google
Sheets:
excel
Copy
=IF(OR(ISBLANK(A2), ISBLANK(B2), ISBLANK(C2)), "Invalid Input",
IF(C2 > 0.1, A2 * B2 * (1 - C2), A2 * B2))
Explanation of Formula:
ISBLANK(A2), ISBLANK(B2), ISBLANK(C2): These check if any of the cells for Quantity
Sold (A2), Unit Price (B2), or Discount (C2) are blank.
OR(ISBLANK(A2), ISBLANK(B2), ISBLANK(C2)): This combines the checks, so if any
one of the cells is blank, it returns "Invalid Input."
C2 > 0.1: This checks if the Discount is greater than 10% (0.1 represents 10% as
a decimal).
A2 * B2 * (1 - C2): If the discount is greater than 10%, this calculates the total
price by applying the discount to the product of Quantity Sold and Unit Price.
A2 * B2: If the discount is 10% or less, it simply calculates the total price without
applying any discount.
After writing this formula in the first row (e.g., row 2) for the "Total Price" column, drag
it down to apply it to the rest of the dataset.
Example:
Formula
10 5 0.12
Result
Formula
15 4 0.08
Result
Formula
8 3 0.15
Result
20 6 Invalid Input
For the first row, the discount is 12% (greater than 10%), so the total price will
be calculated with the discount.
For the second row, the discount is 8% (less than 10%), so the total price will be
calculated without the discount.
The last row is missing the discount value, so it will return "Invalid Input."
Question 2:
To determine whether a student passes or fails based on the given criteria (grade greater than or equal to 50
in both "Midterm" and "Final Exam"), we can use the IF, AND, and OR functions in Excel or Google Sheets.
Step-by-Step Process:
o The student passes if their grade in both the "Midterm" and "Final Exam"
is greater than or equal to 50. The AND function can be used to check if
both conditions are true.
o We want to check if the grade for "Midterm" is greater than or equal to 50
and if the grade for "Final Exam" is also greater than or equal to 50.
o The IF function will return "Pass" if both conditions are true, and "Fail" if
either of the conditions is false.
Formula
excel
Copy
=IF(AND(A2 >= 50, B2 >= 50), "Pass", "Fail")
Explanation of Formula:
AND(A2 >= 50, B2 >= 50): This checks if both conditions are true:
o A2 >= 50 checks if the Midterm grade (in cell A2) is greater than or equal to
50.
o B2 >= 50 checks if the Final Exam grade (in cell B2) is greater than or equal
to 50.
IF(AND(A2 >= 50, B2 >= 50), "Pass", "Fail"): The IF function uses the result of
the AND function:
o If both conditions are true (both grades are greater than or equal to 50), it
returns "Pass".
o If either condition is false (one or both grades are below 50), it returns
"Fail".
Example Table:
Midterm Final Exam Result
(A) (B) (C)
60 55 Pass
45 50 Fail
70 40 Fail
80 90 Pass
In the first row, both grades are greater than or equal to 50, so the result is
"Pass."
In the second row, the Midterm grade is below 50, so the result is "Fail."
In the third row, the Final Exam grade is below 50, so the result is "Fail."
In the fourth row, both grades are greater than or equal to 50, so the result is
"Pass."
Enter this formula in the first row of the "Result" column (e.g., C2).
Drag the formula down to apply it to all other rows in the dataset.
This will efficiently check if a student passes or fails based on their Midterm and Final
Exam grades.
2. Lookup Functions (VLOOKUP, HLOOKUP, INDEX, MATCH)
Question 1:
To find the salary of the employee with ID 12345 using the VLOOKUP function in Excel
or Google Sheets, here's the step-by-step process and formula:
Step-by-Step Process:
excel
Copy
=VLOOKUP(lookup_value, table_array, col_index_num, [range_lookup])
o Lookup_value: The value you want to search for. In this case, it's the
Employee ID 12345.
o Table_array: The range of cells that contains the data. This includes both
the Employee ID and Salary columns.
o Col_index_num: The column number in the table from which to retrieve
the value. In this case, Salary is in column B, which is the 2nd column in
the table.
o [Range_lookup]: This determines whether to return an exact match or
an approximate match. You want an exact match, so set this to FALSE.
Employee ID Salary
(A) (B)
12345 50000
67890 55000
11223 60000
excel
Copy
=VLOOKUP(12345, A2:B4, 2, FALSE)
Result:
The formula will return 50000, which is the salary of the employee with ID 12345.
Notes:
If the Employee ID 12345 is not found, VLOOKUP will return #N/A, indicating that
the lookup value doesn't exist in the specified range.
If you have a large dataset, you might want to use absolute references (e.g.,
$A$2:$B$1000) to lock the range when copying the formula to other cells.
Question 2:
To find the product name corresponding to the product code "P9876" using INDEX and
MATCH functions in Excel or Google Sheets, here's the step-by-step process and the
formula.
Step-by-Step Process:
excel
Copy
=INDEX(array, row_num, [column_num])
array: The range from which you want to retrieve the value.
row_num: The row number in the array from which to return the
value.
[column_num]: Optional. The column number if you're working
with a multi-column array.
o MATCH: This function returns the relative position of a value in a given
range.
The general syntax of MATCH is:
excel
Copy
=MATCH(lookup_value, lookup_array, [match_type])
lookup_value: The value you want to search for (in this case,
"P9876").
P1234 Product A
P9876 Product B
P5678 Product C
The formula to find the product name corresponding to the product code "P9876" is:
excel
Copy
=INDEX(B2:B4, MATCH("P9876", A2:A4, 0))
MATCH("P9876", A2:A4, 0): This part of the formula searches for the product code
"P9876" in the range A2:A4 (Product Code column). The 0 indicates that you want
an exact match. The result will be the row number where "P9876" is found, which
is 2 in this case.
INDEX(B2:B4, 2): The INDEX function then takes that row number (2) and returns
the value from the second row in the B2:B4 range (Product Name column). In this
case, it will return "Product B".
Result:
The formula will return "Product B", which is the product name corresponding to the
product code "P9876".
Notes:
INDEX and MATCH are more flexible than VLOOKUP because you can search
for values in any column and return results from any other column, even if the
lookup column is not the first column.
MATCH will return the relative position of the matched value within the lookup
range, and INDEX uses this position to retrieve the corresponding value from
the result range.
Question 1:
🧠 Goal:
From a full name in the format "First Last", extract only the first name.
📍 Assumption:
✅ Step-by-Step Process:
Step 1: Understand the formula
We need to extract everything from the left of the full name up to just before
the space.
We can use:
FIND(" ", A2) → finds the position of the space (between first and last name).
LEFT(A2, FIND(" ", A2) - 1) → extracts all characters from the left up to the
space (not including it).
FIND(" ", A2) → returns 5 (because the space is the 5th character)
FIND(" ", A2) - 1 → becomes 4
LEFT(A2, 4) → returns "John"
🎉 Result:
Question 2:
🧠 Goal:
Extract the year from a date in cell A1 using the YEAR function.
📍 Assumption:
✅ Step-by-Step Process:
Step 1: Understand the YEAR function
👉 Syntax:
excel
CopyEdit
=YEAR(date)
excel
CopyEdit
=YEAR(A1)
excel
CopyEdit
=YEAR(A1)
👉 Returns: 2025
🎉 Result:
You’ll get the year from the date — just the year (e.g., 2025). ✅
Question 3:
🧠 Goal:
👉 Syntax:
excel
CopyEdit
=CONCATENATE(text1, text2, ...)
We need:
A1 (First Name)
A space " " between the names
B1 (Last Name)
👉 Formula:
excel
CopyEdit
=CONCATENATE(A1, " ", B1)
Step 3: Example
If:
A1 = John
B1 = Doe
The formula:
excel
CopyEdit
=CONCATENATE(A1, " ", B1)
Question 1: Perfect! Let’s walk through how to create a Pivot Table that summarizes total sales by
Product and Sales Region from a dataset with these columns:
Product
Sales Region
Sales Amount
Widget
East 500
A
Widget
West 300
B
Widget
East 200
A
Widget
East 400
B
Widget
West 100
C
🧩 Goal:
It now shows the total sales for each Product, broken down by region.
Example output:
Widget
700 700
A
Widget
400 300 700
B
Widget
100 100
C
110
Total 400 1500
0
Now you’ve got both the summary table and a visual chart!
Question 2:
Great! Let’s continue from where we left off. You already have a Pivot Table that summarizes total sales
by Product and Region — now let’s create a Pivot Chart to visualize that data.
Create a Pivot Chart that visually shows total sales by Product and Region.
Click anywhere inside the Pivot Table you just created (from Question 1).
Pick a chart that clearly shows the data comparison. Common options:
You can now see your chart! Here's how to clean it up:
Add chart title: Click the title to edit (e.g., "Total Sales by Product and Region")
Add data labels (if needed): Right-click on bars → Add Data Labels
Change colors: Use Chart Styles on the top ribbon
📌 Example Layout (Clustered Column Chart)
You’ll see each Product on the X-axis, and Sales Amount on the Y-axis.
Each product will have two bars (or more, depending on the number of regions) — one for each Sales
Region.
2. Advanced Charting Techniques
Question 1:
✅ Goal:
Create a chart that automatically updates as you add more rows of data to your dataset.
🔧 Method: Use Excel’s Table feature (simpler and more powerful than
manual named ranges)
🪜 Step-by-Step Guide:
📍 Step 1: Format your data as a Table
Widget
East 500
A
Widget
West 300
B
✅ Your data is now in an Excel Table (you’ll see filter arrows appear on the headers).
1. Add a new row below your table (e.g., new product, region, and sales amount)
2. Press Enter — the chart should automatically include the new row
🎉 Success! The chart is now dynamic and will update as you add more data.
Question 2:
Great! A combo chart is perfect when you want to visualize two different types of data together — like:
✅ Goal:
Create a Combo Chart where:
🪜 Step-by-Step Guide:
📍 Step 1: Select your data
A dialog box will pop up where you can assign chart types:
Clustered
Total Sales No
Column
👉 Important: Check the box for Secondary Axis next to Profit Margin so the scales make sense.
🪄 Step 4: Click OK
Add chart title: Click the title and type e.g., "Sales vs Profit Margin"
Format axes: Right-click the secondary Y-axis → Format Axis (for % formatting)
Data labels: Right-click → Add Data Labels for clarity
Question 3:
✅ Goal:
Add Sparklines next to a table of monthly sales for multiple products.
Widget
200 250 220 270
A
Widget
300 310 290 330
B
Widget
180 190 210 200
C
🪜 Step-by-Step Guide:
📍 Step 1: Select your data range
1. Click on any sparkline → Use the Sparkline Tools > Design tab to:
o Add markers (for high/low points)
o Change line color
o Highlight negative values
o Choose column-style sparklines instead of lines if you prefer
✅ Result:
You now have a clean visual trend for each product’s monthly sales — right next to the numbers, making
it easy to compare at a glance!
3. Conditional Formatting for Visual Data Insights
Question 1:
✅ Goal:
Use Conditional Formatting to highlight sales figures above the average in green.
John 5000
Sarah 6200
Mike 4800
Emma 7100
🪜 Step-by-Step Guide:
📍 Step 1: Select the sales data
✅ Goal:
Highlight employees whose salary is above 80,000 with a red fill.
75,00
John Doe
0
85,00
Jane Smith
0
95,00
Mike Johnson
0
78,00
Emma Williams
0
🪜 Step-by-Step Guide:
📍 Step 1: Select the salary data
✅ Result:
Now, any employee with a salary above 80,000 will be highlighted in red. For example, Jane Smith and
Mike Johnson would be highlighted, since their salaries are above 80,000.
4. Data Validation and Drop-down Lists
Question 1:
✅ Goal:
Create a drop-down list in a cell that allows users to choose between North, South, East, or West.
🧾 Example Dataset:
Let’s say you want to create the drop-down list in cell A1.
🪜 Step-by-Step Guide:
📍 Step 1: Select the cell for the drop-down list
1. Click on cell A1 (or the cell where you want the drop-down list to appear).
2. Make sure the In-cell dropdown box is checked (this ensures the drop-down arrow shows up in the
cell).
3. Click OK.
Click on cell A1 — you should now see a drop-down arrow. When you click on the arrow, you should be
able to select from North, South, East, and West.
Question 2:
✅ Goal:
Ensure that only numeric values can be entered in a Sales Amount column using data validation.
John 5000
Sarah 6200
Mike 4800
Emma 7100
🪜 Step-by-Step Guide:
📍 Step 1: Select the range for the Sales Amount
1. Highlight the Sales Amount column where you want the validation (e.g., B2:B5).
Alternatively, you could choose other options like between if you want to set a specific range for
sales.
3. (Optional) You can also enter Input Message or Error Alert to guide the user on the type of data
allowed.
Question 1:
✅ Goal:
Determine the sales price per unit required to reach a target revenue of 50,000 when you expect to sell
2,000 units.
🧾 Example:
Item Value
Target
50,000
Revenue
🪜 Step-by-Step Guide:
📍 Step 1: Set up your formula
This formula multiplies Units Sold by Sales Price to give you the Total Revenue.
1. Click OK.
2. Excel will automatically calculate the sales price per unit that you need to reach the target revenue
of 50,000.
✅ Result:
Excel will adjust the Sales Price cell (B3) and display the value required to reach 50,000 in total revenue.
In this case, you will find that the Sales Price per Unit required is 25 (because 2000 units × 25 =
50,000).
Unit 3: Automation and Advanced Spreadsheet Tools
Question 1:
✅ Goal:
Record a macro that:
🧾 Example Dataset:
Nam Ag Departme
e e nt
John 30 Sales
Sarah 25 Marketing
Mike 35 HR
🪜 Step-by-Step Guide:
📍 Step 1: Enable the Developer Tab (if not already enabled)
Before you can record a macro, ensure that the Developer tab is visible in the ribbon:
1. Once you’ve finished formatting the headers, go back to the Developer tab.
2. In the Code group, click Stop Recording.
You should see the headers in your dataset bolded, with a font size of 12, and yellow background — all
applied automatically!
✅ Result:
You can now run this macro anytime you need to apply these formatting changes quickly!
Let me know if you'd like to learn more about VBA programming or automating tasks with macros!
Sure! Let's create a VBA function that takes a range of cells as input and returns the sum of the values in
those cells. This function will allow you to sum a range of values dynamically.
Question 2:
✅ Goal:
🪜 Step-by-Step Guide:
📍 Step 1: Open the VBA Editor
1. Press Alt + F11 to open the Visual Basic for Applications (VBA) Editor.
1. In the VBA editor, go to the Insert menu and click Module. This will create a new module where
you can write your function.
' Loop through each cell in the range and add its value to total
For Each cell In rng
If IsNumeric([Link]) Then
total = total + [Link]
End If
Next cell
Explanation:
The function is called SumRange, and it takes one parameter, rng, which represents the range of cells.
The function loops through each cell in the range using For Each.
It checks if the value in each cell is numeric (IsNumeric([Link])) before adding it to the total.
The function returns the total sum of the numeric values in the specified range.
Now that the function is written, you can use it like any other Excel function:
=SumRange(A1:A5)
✅ Result:
You've created a custom VBA function that takes a range of cells and returns the sum of their values!
For example, if cells A1 through A5 contain the numbers 10, 20, 30, 40, 50, the formula =SumRange(A1:A5)
will return 150.
2. Recording and Editing Macros to Automate Repetitive Tasks
Question 1:
✅ Goal:
Record a macro that:
Inserts the current date in a specific cell (e.g., A1) each time it is run.
🧾 Example:
You want to insert the current date into cell A1 every time the macro runs.
🪜 Step-by-Step Guide:
📍 Step 1: Enable the Developer Tab (if not already enabled)
1. Select cell A1 (or any cell where you want to insert the date).
2. In the formula bar, type the following:
3. =TODAY()
(Alternatively, you can use the keyboard shortcut Ctrl + ; to insert the current date directly into
the cell if you prefer not to use the formula.)
📍 Step 4: Stop Recording the Macro
You should see the current date automatically inserted into cell A1.
✅ Result:
Now, every time you run the macro, cell A1 (or any specified cell) will automatically be updated with the
current date.
Question 2:
✅ Goal:
Edit a previously recorded macro.
Add additional formatting to the cells, such as changing the font color and applying borders.
🧾 Example Scenario:
Let’s say you have a macro that inserts the current date into cell A1. Now, you want to change the font
color to blue and apply a border around cell A1 after the date is inserted.
🪜 Step-by-Step Guide:
📍 Step 1: Open the VBA Editor
1. Press Alt + F11 to open the Visual Basic for Applications (VBA) Editor.
2. In the VBA Editor, look for the Modules section in the Project Explorer on the left side.
3. Double-click on Module1 (or the module where your previously recorded macro is stored). If your
macro was recorded in a different module, open that one.
You should see the recorded macro code in the editor. For example, the recorded macro that inserts the
current date might look like this:
Sub InsertCurrentDate()
Range("A1").Value = Date
End Sub
Now, let’s modify this macro to change the font color and apply a border.
Sub InsertCurrentDate()
' Insert the current date in cell A1
Range("A1").Value = Date
Explanation:
[Link] = RGB(0, 0, 255): This line changes the font color of cell A1 to blue using the RGB
color model.
Borders: This section applies a continuous border around cell A1 with a black color and a thin
weight.
✅ Result:
You’ve successfully edited your previously recorded macro to add additional formatting such as changing
the font color and applying a border.
3. Creating User-Defined Functions (UDFs) in VBA
Question 1:
✅ Objective:
Create a UDF in Excel VBA to calculate the area of a triangle using the formula:
🛠 Step-by-Step Process:
Step 1: Open the Excel Workbook
Open the Excel file where you want to use the function.
Click the X on the top right of the VBA editor or press Alt + Q to close it and return to Excel.
Step 6: Use the Function in Excel
Now you can use your UDF just like any built-in function:
1. Click on a cell.
2. Type:
3. =TriangleArea(10, 5)
4. Press Enter.
5. Excel will return the result 25 (i.e. ½ × 10 × 5).
Instead of typing numbers directly, you can use cell references like this:
=TriangleArea(A1, B1)
Question 1:
✅ Goal:
Import CSV → Remove empty rows → Remove empty columns — all using Excel only
1. Open Excel.
2. Go to the Data tab.
3. Click Get Data → From File → From Text/CSV.
4. Browse to your .csv file and click Import.
5. In the preview window, click Load to bring the data into Excel.
1. Select your data range (or the whole sheet by clicking the square between row and column headers).
2. Press F5 (or Ctrl + G) to open the Go To dialog.
3. Click Special.
4. Select Blanks → Click OK.
5. Right-click one of the selected blank cells → Choose Delete → Select Entire Row → Click OK.
Use Text to Columns under the Data tab to split messy data.
Use Trim() formula to remove extra spaces from cells.
Use Remove Duplicates in the Data tab if needed.
Question 2:
🔁 Overview
✅ Step-by-Step Process
Step 1: Prepare Your Financial Data
Open Excel and arrange your financial data in a tabular format with clear column headers.
Example:
| Date | Description | Amount | Category |
|------------|-------------------|--------|------------|
| 2025-04-01 | Sales Revenue | 5000 | Income |
| 2025-04-02 | Office Supplies | -200 | Expense |
An XML Schema defines the structure and rules for your XML file.
You can:
o Create one manually (if you know how).
o Use Excel to generate an XML from a small sample, then reverse-engineer the schema.
o Use a tool like XMLSpy or an online schema generator.
1. In the XML Source pane, you'll see the structure of your schema.
2. Drag each XML element from the pane to the corresponding cell/column in your worksheet (e.g.,
drag <Date> to the "Date" column).
3. Excel will highlight the mapped areas.
⚠️Note: If your data isn’t mapped correctly or doesn’t match the schema, Excel might give an error.
✅ Result
You now have an .xml file that follows the structure of your schema and contains your financial data —
ready for use in other systems or tools.
Want help creating a sample XSD file or using a tool to generate one?