Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

196
Visualizações
Apps script conditional formatting for value not in array

enter image description here

I have a column containing US state abbreviations. I'd like to have an array of all 50 states:

const states = ['DE','AK','TX','CA' .........]

that the value of each cell in the column is compared against. If its not one of the states I'd like to format it red.

I've looked at conditional formatting (https://developers.google.com/apps-script/reference/spreadsheet/conditional-format-rule-builder#whenTextDoesNotContain(String)) where they have sample code like:

var sheet = SpreadsheetApp.getActiveSheet();
var range = sheet.getRange("A1:B3");
var rule = SpreadsheetApp.newConditionalFormatRule()
.whenTextDoesNotContain("hello")
.setBackground("#FF0000")
.setRanges([range])
.build();
var rules = sheet.getConditionalFormatRules();
rules.push(rule);
sheet.setConditionalFormatRules(rules);

Is there a conditional rule that would allow (in pseudocode):

.whenTextDoesNotContain(states)
about 4 years ago · Santiago Gelvez
1 Respostas
Responde à pergunta

0

Here is an example of using a custom formula in conditional formatting.

I create a data set in A1:A5.

Then I put conditional formatting on A7:A10. The custom formula is =ISNA(MATCH(A7,A$1:A$5,0))

enter image description here

about 4 years ago · Santiago Gelvez Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda