Formula basics#
Every formula starts with =. It can contain values, cell references, operators and functions:
=N2-O2 profit = sales - cost
=SUM(N2:N1501) total sales
=ROUND(P2/N2*100, 1) margin % rounded to 1 decimal
Operators: + - * / ^ (power), & (join text), comparisons = <> > < >= <=.
Relative, absolute and mixed references#
When you copy a formula, Excel adjusts references:
| Reference | Copying down / across | Use when |
|---|---|---|
A2 relative |
row and column both change | normal row-by-row calculations |
$A$2 absolute |
never changes | a fixed cell: GST rate, target, exchange rate |
$A2 mixed |
column fixed, row changes | multiplication tables, cross-tab grids |
A$2 mixed |
row fixed, column changes |
Press F4 while the cursor is on a reference to cycle through A2 → $A$2 → A$2 → $A2.
Put the GST rate 18% in cell T1. In U2:
=N2*$T$1
Copy down - N2 becomes N3, N4... but $T$1 stays fixed. Without the $, the formula in row 3 would point to T2 (empty) and return 0.
Formula copy करने पर Excel cell references को अपने-आप खिसका देता है - इसे relative reference कहते हैं (A2)।
लेकिन कुछ cells हमेशा एक ही रहनी चाहिए - जैसे GST rate वाली cell। उसके आगे $ लगाने से वह absolute reference बन जाती है ($T$1) और copy करने पर नहीं बदलती।
Formula लिखते समय reference पर cursor रखकर F4 दबाएँ - $ अपने-आप लग जाएगा।
Essential aggregate functions#
| Function | Returns | Example |
|---|---|---|
SUM |
total | =SUM(tblSales[sales]) |
AVERAGE |
mean | =AVERAGE(tblSales[sales]) |
MEDIAN |
middle value | =MEDIAN(tblSales[sales]) |
MIN / MAX |
smallest / largest | =MAX(tblSales[sales]) |
COUNT |
count of numbers | =COUNT(tblSales[quantity]) |
COUNTA |
count of non-empty cells | =COUNTA(tblSales[order_id]) |
COUNTBLANK |
count of empty cells | =COUNTBLANK(Raw_Data!C2:C313) |
UNIQUE (365) |
list of distinct values | =UNIQUE(tblSales[city]) |
COUNTA(UNIQUE(...)) |
number of distinct values | =COUNTA(UNIQUE(tblSales[customer_id])) |
Logical functions#
IF#
=IF(condition, value_if_true, value_if_false)
=IF(P2<0, "Loss", "Profit")
=IF(N2>=10000, "Big order", "Regular")
AND, OR, NOT#
=IF(AND(H2="Technology", N2>=20000), "Priority", "Normal")
=IF(OR(Q2="UPI", Q2="Card"), "Digital", "Offline")
Nested IF vs IFS#
Order size slabs - nested IF:
=IF(N2>=50000, "Very large", IF(N2>=10000, "Large", IF(N2>=2000, "Medium", "Small")))
The same with IFS (Excel 2019+), easier to read:
=IFS(N2>=50000, "Very large", N2>=10000, "Large", N2>=2000, "Medium", TRUE, "Small")
TRUE at the end acts as "everything else".
Conditional aggregation - the analyst's favourite functions#
| Function | Syntax |
|---|---|
COUNTIF |
=COUNTIF(criteria_range, criteria) |
SUMIF |
=SUMIF(criteria_range, criteria, sum_range) |
COUNTIFS |
=COUNTIFS(range1, crit1, range2, crit2, ...) |
SUMIFS |
=SUMIFS(sum_range, range1, crit1, range2, crit2, ...) |
AVERAGEIFS |
=AVERAGEIFS(avg_range, range1, crit1, ...) |
MAXIFS / MINIFS |
=MAXIFS(max_range, range1, crit1, ...) |
Examples on tblSales:
Orders paid by UPI
=COUNTIF(tblSales[payment_mode], "UPI")
Orders of Rs. 10,000 or more
=COUNTIF(tblSales[sales], ">=10000")
Technology orders in Indore
=COUNTIFS(tblSales[category], "Technology", tblSales[city], "Indore")
North sales in 2025
=SUMIFS(tblSales[sales], tblSales[region], "North",
tblSales[order_date], ">="&DATE(2025,1,1),
tblSales[order_date], "<="&DATE(2025,12,31))
Average discount on Furniture
=AVERAGEIFS(tblSales[discount], tblSales[category], "Furniture")
SUMIFS / COUNTIFS - "शर्तों के साथ जोड़ना / गिनना"। Pivot table के बिना भी summary बनाने का सबसे ताकतवर तरीका।
=SUMIFS(क्या जोड़ना है, कहाँ देखना है, क्या ढूँढना है, ...)
जैसे: "North region की 2025 की बिक्री" = sales column जोड़ो, जहाँ region = "North" और तारीख़ 2025 के अंदर हो।
ध्यान दें: SUMIF में जोड़ने वाली range आखिर में आती है, लेकिन SUMIFS में सबसे पहले - यह आम गलती है।
Criteria tricks#
| Criteria | Meaning |
|---|---|
"North" |
equals North (not case-sensitive) |
"<>North" |
not North |
">=10000" |
greater than or equal to 10,000 |
">="&T1 |
compare with a cell value |
"*Laptop*" |
contains "Laptop" (wildcards * and ?) |
"" |
blank |
Building a summary table with SUMIFS#
| A (Region) | B (Sales 2025) | C (Target) | D (Achievement %) | |
|---|---|---|---|---|
| 2 | North | =SUMIFS(tblSales[sales], tblSales[region], A2, tblSales[order_date], ">="&DATE(2025,1,1)) |
from Targets sheet | =B2/C2 |
Write the region names in column A, then copy the formula down - the criteria A2 changes to A3, A4....
Date functions#
| Function | Result for 21-Oct-2025 |
|---|---|
=YEAR(B2) |
2025 |
=MONTH(B2) |
10 |
=DAY(B2) |
21 |
=TEXT(B2, "mmm-yy") |
Oct-25 |
=TEXT(B2, "dddd") |
Tuesday |
=WEEKDAY(B2, 2) |
2 (Mon = 1) |
=EOMONTH(B2, 0) |
31-Oct-2025 (end of month) |
=EDATE(B2, 3) |
21-Jan-2026 (3 months later) |
=TODAY() |
today's date |
=NETWORKDAYS(B2, C2) |
working days between two dates |
=DATEDIF(B2, TODAY(), "m") |
complete months since B2 |
Add helper columns Year and Month (=YEAR([@order_date]), =TEXT([@order_date],"mmm")) to your Table - pivots and SUMIFS become much simpler.
Text functions#
| Function | Example | Result |
|---|---|---|
LEFT(text, n) |
=LEFT("VM-2025-00811", 2) |
VM |
MID(text, start, n) |
=MID("VM-2025-00811", 4, 4) |
2025 |
RIGHT(text, n) |
=RIGHT("VM-2025-00811", 5) |
00811 |
LEN |
=LEN("Indore") |
6 |
FIND / SEARCH |
=FIND("-", "VM-2025") |
3 |
SUBSTITUTE |
=SUBSTITUTE("98-765-43210","-","") |
9876543210 |
TEXT |
=TEXT(1234.5, "₹#,##0.00") |
₹1,234.50 |
& / CONCAT / TEXTJOIN |
=E2&", "&D2 |
Indore, Madhya Pradesh |
Rounding and error handling#
=ROUND(P2/N2, 3) 3 decimals
=ROUNDUP(A2, 0) =ROUNDDOWN(A2, 0)
=MROUND(A2, 50) nearest 50 (pricing)
=IFERROR(P2/N2, 0) 0 instead of #DIV/0!
Common errors:
| Error | Meaning |
|---|---|
#DIV/0! |
division by zero / blank |
#N/A |
lookup value not found |
#VALUE! |
wrong type (text in a calculation) |
#REF! |
reference to a deleted cell |
#NAME? |
misspelled function or missing quotes around text |
#### |
column too narrow (not an error) |
Practice - use the Sales sheet#
1. How many orders were paid by UPI?
=COUNTIF(tblSales[payment_mode],"UPI") → 698
2. How many orders are Rs. 10,000 or more?
=COUNTIF(tblSales[sales],">=10000") → 320
3. How many Technology orders came from Indore?
=COUNTIFS(tblSales[category],"Technology",tblSales[city],"Indore") → 17
4. What were North region sales in 2025?
SUMIFS with region and two date criteria → Rs. 12,24,914.50
5. What is the average discount on Furniture?
=AVERAGEIFS(tblSales[discount],tblSales[category],"Furniture") → 0.0713 (format as % → 7.13%)
6. What were Central region sales in October 2025?
=SUMIFS(tblSales[sales], tblSales[region],"Central", tblSales[order_date],">="&DATE(2025,10,1), tblSales[order_date],"<="&DATE(2025,10,31)) → Rs. 36,326.25
7. Add a column "Order size" with Very large / Large / Medium / Small using IFS. How many "Very large" orders?
Use the IFS formula above, then =COUNTIF(tblSales[Order size],"Very large") → 34 orders. Most are laptops (20 HP + 6 Lenovo), but bulk orders of ergonomic chairs and bookcases also cross Rs. 50,000.
Summary#
- Use
$(F4) for fixed cells; relative references for row-by-row formulas. - IF / IFS / AND / OR create categories and flags.
- COUNTIFS, SUMIFS, AVERAGEIFS summarise with multiple conditions - remember SUMIFS puts the sum range first.
- Date and text functions build helper columns (Year, Month, codes).
- Handle errors with IFERROR and understand what each error means.