Checks whether a text value is a valid ISBN-13
=LET(
s, REGEXREPLACE(TRIM(TO_TEXT(isbn)), "[^0-9]", ""),
IF(
LEN(s)<>13,
FALSE,
LET(
first12, LEFT(s, 12),
given_cd, VALUE(RIGHT(s, 1)),
sum, SUMPRODUCT(
VALUE(MID(first12, SEQUENCE(1, 12), 1)),
{1,3,1,3,1,3,1,3,1,3,1,3}
),
calc_cd, MOD(10 - MOD(sum, 10), 10),
given_cd=calc_cd
)
)
)This function validates whether a text value is a correctly-formed ISBN-13, including its checksum. It ignores hyphens and spaces, confirms the value is 13 digits, and verifies the Modulus 10 checksum used by ISBN-13 (alternating weights of 1 and 3). It's useful for cleaning book lists, validating inventory spreadsheets, or catching ISBN typos during data entry. This does not verify that the ISBN exists or corresponds to a real book, it only checks the checksum structure. For example, if A2 contains "978-0-306-40615-7" then =IS_VALID_ISBN13(A2) returns TRUE, while if A3 contains "978-0-306-40615-8" then it returns FALSE.
Use the inputs below to create IS_VALID_ISBN13 as a reusable custom function in Google Sheets.
Learn how to add custom functions to Google SheetsIS_VALID_ISBN13
Checks whether a text value is a valid ISBN-13
=LET( s, REGEXREPLACE(TRIM(TO_TEXT(isbn)), "[^0-9]", ""), IF( LEN(s)<>13, FALSE, LET( first12, LEFT(s, 12), given_cd, VALUE(RIGHT(s, 1)), sum, SUMPRODUCT( VALUE(MID(first12, SEQUENCE(1, 12), 1)), {1,3,1,3,1,3,1,3,1,3,1,3} ), calc_cd, MOD(10 - MOD(sum, 10), 10), given_cd=calc_cd ) ) )
isbn
ISBN-13 value to validate
A2
Other functions in the same category: Data Validation
Checks whether a text value is a valid ISBN-10
Checks whether a text value is a valid IPv4 address
Checks whether a text value is a valid IPv6 address
Checks whether a text value matches a basic email address format
Checks whether a text value matches a basic HTTP/HTTPS URL format
Checks whether a text value matches a standard UUID format
Named functions enable the creation of custom, reusable formulas that mimic built-in functions, streamlining calculations and data manipulations. These functions simplify complex formulas, making spreadsheets more readable and less prone to errors. By encapsulating intricate logic within a single function call, they enhance consistency across your data. Utilizing named functions reduces the need to write lengthy formulas repeatedly, thereby improving workflow efficiency and productivity in data analysis and management.
Download and import — fastest way to add the function but does not include argument descriptions and examples
Follow these simple steps to download and import a function into your spreadsheet. This method is the quickest and easiest way to add the named function to your Google Sheets document, but will not include the argument description and examples.
Once added, the function will be ready to use in your document like any other built-in function. Simply type the function name and provide the required inputs to use it in your calculations.
Copy and paste — copy and paste each property one at a time
Follow these simple steps to integrate a custom named function into your spreadsheet:
Once added, the function will be ready to use in your document like any other built-in function. Simply type the function name and provide the required inputs to use it in your calculations.