Formula library
Excel formula list: ready-to-copy formulas for Excel and Google Sheets
42 formulas checked by hand, each with an explanation, an example and a Google Sheets version. Free and unlimited.
Lookup
- INDEX and MATCH
A flexible lookup that works in every version of Excel and Google Sheets and can look left.
Explanation, example and Sheets version=INDEX(Products!$C$2:$C$100, MATCH(A2, Products!$A$2:$A$100, 0)) - Look up a value from another file or tab
Pull matching data from a different tab, or from another Google Sheets file with IMPORTRANGE.
Explanation, example and Sheets version=XLOOKUP(A2, 'Price List'!A:A, 'Price List'!B:B, "") - Lookup with two criteria
Return a value where two columns both match, for example a price by product and size.
Explanation, example and Sheets version=XLOOKUP(1, (A2:A100=F2)*(B2:B100=G2), C2:C100, "Not found") - VLOOKUP with an exact match
Find a value in the first column of a table and return a value from another column in the same row.
Explanation, example and Sheets version=VLOOKUP(A2, Products!$A$2:$C$100, 3, FALSE) - XLOOKUP with a "not found" message
The modern replacement for VLOOKUP: look up in any column, return from any column, with a built-in fallback.
Explanation, example and Sheets version=XLOOKUP(A2, Products!A2:A100, Products!C2:C100, "Not found")
Conditional sums & counts
- Average with conditions
Average only the values that meet one or more conditions.
Explanation, example and Sheets version=IFERROR(AVERAGEIFS(C2:C100, B2:B100, "Sales"), 0) - COUNTIFS with a number and a text condition
Count rows that pass several tests, such as orders over 500 that are marked Paid.
Explanation, example and Sheets version=COUNTIFS(D2:D100, ">500", E2:E100, "Paid") - Sum values for a given month
Total everything dated in the same month as a date you choose.
Explanation, example and Sheets version=SUMIFS(C2:C100, A2:A100, ">="&F1, A2:A100, "<="&EOMONTH(F1, 0)) - Sum only visible (filtered) rows
A total that updates when you filter the table and ignores hidden rows.
Explanation, example and Sheets version=SUBTOTAL(109, C2:C100) - SUMIFS with multiple criteria
Add up values that meet several conditions at once, like sales for one region and status.
Explanation, example and Sheets version=SUMIFS(D2:D100, B2:B100, "West", C2:C100, "Paid")
Logic & errors
- IF with AND / OR
Return one result when several conditions are all true (AND) or when any is true (OR).
Explanation, example and Sheets version=IF(AND(B2>=50, C2="Yes"), "Pass", "Fail") - Hide errors with IFERROR
Show a clean value instead of #DIV/0!, #N/A or other errors.
Explanation, example and Sheets version=IFERROR(B2/C2, 0) - Letter grades with IFS
Turn a score into a grade without deeply nested IFs.
Explanation, example and Sheets version=IFS(A2>=90, "A", A2>=80, "B", A2>=70, "C", A2>=60, "D", TRUE, "F") - Flag overdue tasks
Mark a row as Overdue when its due date has passed and it is not done.
Explanation, example and Sheets version=IF(AND(C2<>"", C2<TODAY(), D2<>"Done"), "Overdue", "")
Text
- Combine text from several cells
Join first and last names, or any columns, with a separator and no stray spaces.
Explanation, example and Sheets version=TEXTJOIN(" ", TRUE, A2, B2, C2) - Check if a cell contains a word
Return Yes or No depending on whether some text appears anywhere in a cell.
Explanation, example and Sheets version=IF(ISNUMBER(SEARCH("refund", A2)), "Yes", "No") - Extract an email address from text
Pull the email address out of a sentence or a messy cell using a regular expression.
Explanation, example and Sheets version=REGEXEXTRACT(A2, "[A-Za-z0-9._%+-]+@[A-Za-z0-9.-]+\.[A-Za-z]{2,}") - Extract the first name
Get everything before the first space in a full name.
Explanation, example and Sheets version=LEFT(A2, FIND(" ", A2&" ")-1) - Extract the last name
Get the last word of a full name, even when there is a middle name.
Explanation, example and Sheets version=TRIM(RIGHT(SUBSTITUTE(TRIM(A2), " ", REPT(" ", 100)), 100)) - Keep only the digits
Strip letters, spaces and symbols so only the numbers remain, for example from phone numbers.
Explanation, example and Sheets version=REGEXREPLACE(A2, "[^0-9]", "") - Change text case
Convert names to Proper Case, or any text to UPPER or lower case.
Explanation, example and Sheets version=PROPER(TRIM(A2)) - Split text into columns
Break "red, green, blue" into separate cells with one formula.
Explanation, example and Sheets version=TEXTSPLIT(A2, ", ") - Remove extra spaces and hidden characters
Clean up text pasted from websites or other systems so lookups and comparisons work.
Explanation, example and Sheets version=TRIM(CLEAN(SUBSTITUTE(A2, CHAR(160), " ")))
Dates
- Add months to a date
Move a date forward or back by whole months, for renewals and due dates.
Explanation, example and Sheets version=EDATE(A2, B2) - Calculate age from a date of birth
Get someone's age in whole years, as of today.
Explanation, example and Sheets version=DATEDIF(A2, TODAY(), "Y") - Days between two dates
Count the calendar days from a start date to an end date.
Explanation, example and Sheets version=DAYS(B2, A2) - Last day of the month
Find the month-end date for any date, useful for billing and reports.
Explanation, example and Sheets version=EOMONTH(A2, 0) - Day of the week from a date
Show the weekday name, like Monday, for any date.
Explanation, example and Sheets version=TEXT(A2, "dddd") - Working days between two dates
Count Monday to Friday between two dates, optionally skipping holidays.
Explanation, example and Sheets version=NETWORKDAYS(A2, B2, Holidays!$A$2:$A$20)
Lists & duplicates
- Count unique values
Count how many different values a column contains.
Explanation, example and Sheets version=SUMPRODUCT((A2:A100<>"")/COUNTIF(A2:A100, A2:A100&"")) - Show only rows that match
Return every row where a column has a certain value, as a live list.
Explanation, example and Sheets version=FILTER(A2:D100, C2:C100="Open", "None") - Flag duplicate values
Mark every value that appears more than once in a column.
Explanation, example and Sheets version=IF(COUNTIF($A$2:$A$100, A2)>1, "Duplicate", "") - Rank values
Give each row its position, with 1 for the highest value.
Explanation, example and Sheets version=RANK.EQ(B2, $B$2:$B$100, 0) - Top 5 by value
List the five highest rows, for example top products by sales.
Explanation, example and Sheets version=TAKE(SORT(A2:B100, 2, -1), 5) - Get a list of unique values
Make a de-duplicated, sorted list from a column that updates automatically.
Explanation, example and Sheets version=SORT(UNIQUE(FILTER(A2:A100, A2:A100<>"")))
Math, percentages & finance
- Compound interest
See what savings grow to with monthly compounding.
Explanation, example and Sheets version=FV(B1/12, B2*12, 0, -B3) - Monthly loan payment
Work out the fixed monthly payment for a loan or mortgage.
Explanation, example and Sheets version=PMT(B1/12, B2*12, -B3) - Percentage change
Show the growth or decline from an old value to a new value.
Explanation, example and Sheets version=IFERROR((B2-A2)/A2, "") - Percentage of total
Show each row's share of the column total.
Explanation, example and Sheets version=B2/SUM($B$2:$B$100) - Pick a random item from a list
Choose a random name or row, for giveaways or sampling.
Explanation, example and Sheets version=INDEX(A2:A100, RANDBETWEEN(1, COUNTA(A2:A100))) - Running total
A cumulative sum that grows row by row.
Explanation, example and Sheets version=SUM($B$2:B2) - Weighted average
Average where some values count more than others, like grades with credit hours.
Explanation, example and Sheets version=SUMPRODUCT(B2:B10, C2:C10)/SUM(C2:C10)
Can't find the one you need?
Describe it in plain English and the AI writes it for your exact columns and Excel version.
Generate a formula