Skip to main content

Hi everybody,

if I can ask for help with formulas in IF statements

I have developed Glide app with Airtable, works really good.

I have a table WorkOrders, and among other columns, I have:

"Start time", "Start kilometers", "End Time", "End kilometers", "Total km", "Total time", "Status".

This formula is in column "Status", works good:

IF(OR({NameSurname}="",{Startkm}=""),"CREATED",IF({Endkm}="","IN PROCESS",IF({Endkm}>{Startkm},"COMPLETED")))

How can I add another Status, Canceled?

Button CANCEL in Glide updates the fields: Startkm and Endkm to 0 (zero), StartTime and EndTime to CurrentTime (same data in StartTime and EndTime)

Can you help me with the formula?

Thank you very much  

 

 

Hm, personally I'd split it out like this as it's easier for me to look at:

IF(
AND(
Startkm="",
Endkm="",
Startkm != "0",
Endkm != "0"
),
"CREATED"
) &
IF(
AND(
NameSurname,
Startkm,
Endkm=""
),
"IN PROCESS"
) &
IF(
AND(
Endkm > Startkm,
NameSurname
),
"COMPLETED"
) &
IF(
AND(
NameSurname,
Startkm = "0",
Endkm = "0"
),
"CANCELED"
)


Hm, personally I'd split it out like this as it's easier for me to look at:

IF(
AND(
Startkm="",
Endkm="",
Startkm != "0",
Endkm != "0"
),
"CREATED"
) &
IF(
AND(
NameSurname,
Startkm,
Endkm=""
),
"IN PROCESS"
) &
IF(
AND(
Endkm > Startkm,
NameSurname
),
"COMPLETED"
) &
IF(
AND(
NameSurname,
Startkm = "0",
Endkm = "0"
),
"CANCELED"
)


Thank you very very much, it works 🙂

 


Funny example of 'when you code is a mess, but it works  🤣',
I would not recommend it to use in real life

 


Reply