Unit 1: Complex Formulas and Functions
1. Complex Formulas and Logical Functions
Q1: Total Price with Conditional Discount and Error Check
excel
Copy
=IF(OR(ISBLANK(A2), ISBLANK(B2), ISBLANK(C2)), "Invalid Input", IF(C2>10%,
A2*B2*(1-C2), A2*B2))
(Assuming A2 = Quantity Sold, B2 = Unit Price, C2 = Discount)
Q2: Pass/Fail Check
excel
Copy
=IF(AND(A2>=50, B2>=50), "Pass", "Fail")
(Assuming A2 = Midterm, B2 = Final Exam)
2. Lookup Functions
Q1: VLOOKUP for Employee Salary
excel
Copy
=VLOOKUP(12345, A:B, 2, FALSE)
Q2: INDEX & MATCH for Product Name
excel
Copy
=INDEX(B:B, MATCH("P9876", A:A, 0))
3. Text and Date/Time Functions
Q1: Extract First Name
excel
Copy
=LEFT(A2, FIND(" ", A2)-1)
(Assuming full name in A2)
Q2: Extract Year from Date
excel
Copy
=YEAR(A1)
Q3: Concatenate First and Last Name
excel
Copy
=CONCATENATE(A1, " ", B1)
Unit 2: Data Analysis and Visualization
1. Pivot Tables and Charts
Q1: Insert a pivot table with:
Rows: Product
Columns: Sales Region
Values: Sum of Sales Amount
Q2: Create a pivot chart (e.g., clustered column chart) from the pivot table.
2. Advanced Charting Techniques
Q1: Use a named range or convert your data to a Table (Insert > Table) for dynamic charts.
Q2: Combo Chart:
Insert > Combo Chart
Set Sales as Column, Profit Margin as Line.
Q3: Add Sparklines:
Insert > Sparklines (Line)
Select data range and destination.
3. Conditional Formatting
Q1: Highlight values > average:
Conditional Formatting > New Rule > "Format only cells that are above average" >
Green fill.
Q2: Highlight salaries > 80000:
Conditional Formatting > "Cell Value > 80000" > Red fill.
4. Data Validation
Q1: Drop-down for regions:
Data > Data Validation > List: North, South, East, West
Q2: Numeric input only:
Data > Data Validation > Allow: Whole number or Decimal.
5. What-If Analysis
Q1: Goal Seek:
Set formula cell = Revenue
Set value = 50000
By changing = Price per unit
Unit 3: Automation and Advanced Tools
1. Macros & VBA
Q1: Record a macro to format headers:
1. Select headers
2. Bold
3. Set font size 12
4. Fill color: Yellow
Q2: VBA Sum Function
vba
Copy
Function SumRange(rng As Range) As Double
SumRange = Application.WorksheetFunction.Sum(rng)
End Function
2. Record & Edit Macros
Q1: Insert current date
vba
Copy
Sub InsertDate()
Range("A1").Value = Date
End Sub
Q2: Edit Macro to add formatting
vba
Copy
Sub FormatDate()
Range("A1").Value = Date
Range("A1").Font.Color = RGB(0, 0, 255)
Range("A1").Borders.LineStyle = xlContinuous
End Sub
3. User-Defined Function (UDF)
Q1: Triangle Area
vba
Copy
Function TriangleArea(base As Double, height As Double) As Double
TriangleArea = 0.5 * base * height
End Function
4. Data Import/Export
Q1:
Data > Get External Data > From Text/CSV
Clean using filter, remove blanks.
Q2:
File > Save As > Choose XML Data (*.xml)