Help

Re: "Long" formula issue

Solved
Jump to Solution
809 1
cancel
Showing results for 
Search instead for 
Did you mean: 
alternaz
6 - Interface Innovator
6 - Interface Innovator

Hello,

I'm totally new in the formula game, I created mine by putting pieces of tutorials together and using answers obtained here (by the way, thanks to the community!)

That's the deal :

When my cell x show 1h, I need to show 0
When my cell x show 2h, I need to show 0
When my cell x show 3h, I need to show 0
When my cell x show 4h, I need to show 1
When my cell x show 5h, I need to show 2
When my cell x show 6h, I need to show 0

I wrote :

Capture d’écran 2022-12-03 à 17.58.54.png

IF(
   OR(
      {Durée estimée} = "1h", 
      {Durée estimée} = "2h",
      {Durée estimée} = "3h"
      {Durée estimée} = "6h"
   ),
   "0"
)
IF(
   OR(
      {Durée estimée} = "4h", 
   ),
   "1"
)
IF(
   OR(
      {Durée estimée} = "5h", 
   ),
   "2"



I do not yet master the closing of the command and I think it comes from there

Do you have an idea please?

1 Solution

Accepted Solutions
Andrey_Kovalev
8 - Airtable Astronomer
8 - Airtable Astronomer

@alternazYou can write the formula this way:

IF(
  OR(
  {Text} = "1h",
  {Text} = "2h",
  {Text} = "3h",
  {Text} = "6h"
  ), "0", 
  IF({Text} = "4h", "1", 
    IF({Text} = "5h", "2"
    )
  )
)

See Solution in Thread

3 Replies 3
Andrey_Kovalev
8 - Airtable Astronomer
8 - Airtable Astronomer

@alternazYou can write the formula this way:

IF(
  OR(
  {Text} = "1h",
  {Text} = "2h",
  {Text} = "3h",
  {Text} = "6h"
  ), "0", 
  IF({Text} = "4h", "1", 
    IF({Text} = "5h", "2"
    )
  )
)

Do you want a number or a text string that looks like a number? If you want an actual number, remove the quotes around the numbers.

You might also consider using a SWITCH() instead of nested IF().

SWITCH( {Durée estimée},

"4h", 1,

"5h", 2,

0

)

Hi Andrey, perfect answer, thanks a lot 🙂