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

152
Visualizações
Function "length" not working properly in google apps script

I made function in the google sheet

function AVG_ZERO(input) {
  return input.length
};

But length of array different If the range of numbers is located in a column, then it is considered correct If the range of numbers is located in a string, then the length is 1 Links to images: https://postimg.cc/56xfmhZh https://postimg.cc/HVc13T6P

about 4 years ago · Juan Pablo Isaza
2 Respostas
Responde à pergunta

0

Try unfolding the array by using the Array.flat() function into separate elements regardless of the orientation:

function AVG_ZERO(input) {
  return input.flat().length
};

That will give you 3 for both row and column.

enter image description here

about 4 years ago · Juan Pablo Isaza Relatório

0

Issue:

If you pass a range of cells as an argument of a custom function, the argument will be treated by your custom function as a two-dimensional array of the cell's values, with the inner arrays being the individual rows. That is, the outer array length will equal the number of rows in your range: 1 for B1:D1 and 3 for B1:B3.

Reference:

  • Custom functions: Arguments
about 4 years ago · Juan Pablo Isaza 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