Skip to content

Instantly share code, notes, and snippets.

@franklinbaldo
Last active June 16, 2017 02:04
Show Gist options
  • Save franklinbaldo/49d0c1710eee916db5417ddfa0887426 to your computer and use it in GitHub Desktop.
Save franklinbaldo/49d0c1710eee916db5417ddfa0887426 to your computer and use it in GitHub Desktop.
FORMULA PARA VALIDAR CNPJ NO GOOGLE SPREESHET

cnpj

=AND(text(mod(sum(ARRAYFORMULA(ARRAYFORMULA(right(left(A2;{1;2;3;4;5;6;7;8;9;10;11;12});1)){6;7;8;9;2;3;4;5;6;7;8;9}));11);"0")=text(right(left(A2;13);1);"0");RIGHT(text(mod(sum(ARRAYFORMULA(ARRAYFORMULA(right(left(A2;{1;2;3;4;5;6;7;8;9;10;11;12;13});1)){5;6;7;8;9;2;3;4;5;6;7;8;9}));11);"0");1)=text(right(A2;1);"0"))

cpf

=AND(RIGHT(TEXT(mod(SUM(ARRAYFORMULA(ARRAYFORMULA(RIGHT(LEFT(A4;{1;2;3;4;5;6;7;8;9});1))*{10;9;8;7;6;5;4;3;2}))10;11);"0");1)&RIGHT(TEXT(mod(SUM(ARRAYFORMULA(ARRAYFORMULA(RIGHT(LEFT(A4;{1;2;3;4;5;6;7;8;9;10});1)){11;10;9;8;7;6;5;4;3;2}))*10;11);"0");1)=right(A4;2);ARRAYFORMULA(AND({1;2;3;4;5;6;7;8;9;10;11}*11111111111<>A4)))

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment