Help

Re: Treat results in a IF formula as numbers instead of text

780 0
cancel
Showing results for 
Search instead for 
Did you mean: 
Andres_Gomez
5 - Automation Enthusiast
5 - Automation Enthusiast

Hi. I have an IF formula that should result in a number (except for one particular case). I need the result to be treated as a number and not text, so I can count the values, etc. I’ve set the results as a number with no “”, and tried formatting as an integer, but it still doesn’t work.

Any workaround for this?

Here is the formula:

IF({Festivo especial}=1,“NEGOCIAR!”,IF(AND({< 7AM}=“SI”,{+12h}=“SI”),50,IF({FM Trabajo}=1,40,IF(OR({+12h}=“SI”,{Fin de semana}=“SI”,{Festivo}=1),30,IF(OR({< 7AM}=“SI”,{FM Viaje/Descanso}=1),20)))))

This is the table: (the field to look at is “Importe”)
https://airtable.com/shr1hzKX9IJzAgIec

Here is an example where you can see it doesn’t SUM the values:
https://airtable.com/shrE71ocEdRT5MU12

I hope somebody can give me a hint. Thanks!

3 Replies 3
Andres_Gomez
5 - Automation Enthusiast
5 - Automation Enthusiast

Well… I will reply to myself but leave this here in case it helps anyone. The problem was with that one result that was text instead of a number. If I change it for a number, it starts counting.

I wonder if there is a way to keep my text as an optional result for the IF, though.

Hola Andrés!

Contar valores no depende de que sea número o no. De hecho hay varias funciones para contar que son diferentes:

  • COUNT, cuenta solo números
  • COUNTA, cuenta números y cadenas
  • COUNTALL, cuenta incluso celdas vacías

Te dejo la referencia: https://support.airtable.com/hc/en-us/articles/203255215-Formula-field-reference

Sin comillas es número (bien por esa parte), pero el formato del resultado depende del tipo del resultado, y si hay varios tipos de resultado no puedes establecer un formato. He hecho una pequeña prueba: https://airtable.com/shrgBD7a1Am2HL7HP

Lo único que puedo recomendarte es separar la fórmula en más campos, para tener por un lado las cadenas y por otro los números (aviso que no he estudiado la fórmula, es muy complicada :grinning_face_with_sweat: ).

Muchas gracias por la ayuda Elías!

Echaré un ojo a la fórmula COUNT, parece interesante. Por ahora, como comenté, he dejado la única cadena como un número, así me permite hacer operaciones con los resultados de la fórmula. Separarla no me merece la pena ahora mismo.

Un saludo!