# "Long" formula issue

Solved
Jump to Solution
1222 3
cancel
Showing results for
Search instead for
Did you mean:
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 :

``````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
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"
)
)
)``````
3 Replies 3
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"
)
)
)``````
18 - Pluto

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

)

6 - Interface Innovator

Hi Andrey, perfect answer, thanks a lot 🙂