FormulaCraft

How to check if text ends with a value in Excel and Google Sheets

Excel & Google Sheets
=RIGHT(A2,4)=".csv"

Verified example

Computed by a real spreadsheet engine on the sample data below.

FilenameIs CSV?
report.csv
data.xlsx
log.csv
notes.txt
backup.csv

=RIGHT(A2,4)=".csv"TRUE

Try it with your data

Edit the grid or formula, then run it through a real spreadsheet engine — no signup.

Sample data — click any cell to edit

Runs server-side · free · no signup

Step by step

  1. 1Enter =RIGHT(A2,4)=".csv" to check whether the last 4 characters equal ".csv".
  2. 2Adjust the length (4) to match the number of characters in your suffix.
  3. 3Wrap in IF for a label: =IF(RIGHT(A2,4)=".csv","CSV file","Other").
  4. 4For case-insensitive checking, use LOWER: =LOWER(RIGHT(A2,4))=".csv".

Tips

Need it for your exact data?

Describe your columns in plain English and get the precise formula for your sheet, with the right Excel or Sheets syntax.

Frequently asked

What if the suffix length is variable?

Use SEARCH or FIND with a wildcard pattern via COUNTIF ("*suffix") which handles any prefix length without needing to specify a character count.

How do I check for multiple possible suffixes?

Use SUMPRODUCT: =SUMPRODUCT((RIGHT(A2,{4,5})={".csv",".xlsx"})*1)>0 — returns TRUE if the cell ends with any of the listed extensions.

Formulas used

Written and reviewed by FormulaCraft Team. Each formula on this page is run through our verification engine before publishing.

Last reviewed: