Apr 17, 2024 01:48 AM
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
Solved! Go to Solution.
Apr 17, 2024 02:29 AM
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"
)
Apr 17, 2024 02:29 AM
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"
)
Apr 17, 2024 03:02 AM
Thank you very very much, it works 🙂
Apr 17, 2024 03:52 AM
Funny example of 'when you code is a mess, but it works 🤣',
I would not recommend it to use in real life