Help

Welcome to the Airtable Community! If you're new here, check out our Getting Started area to get the most out of your community experience.

Need help with a formula for choosing between 2 options

Topic Labels: Formulas
246 8
cancel
Showing results for 
Search instead for 
Did you mean: 

Hello everyone! 

I've made a table that works as a 'Recurring tasks' table. When someone finishes a job, they'll mark the job as done by using a checkmark (se picture). 

The task can either be a daily task or a weekly task. If it's daily the 'Daglig' checkmark will be used, if it's weekly, the 'Ugentlig' checkmark will be used. 

Depending on what's chosen the table will find the right "next due date". 

The thing is however: the table is grouped by the field 'Hyppighed' (how often a task is being made), so when a task is being checked, it will be moved to an 'Empty' group since 'Hyppighed' isn't automatically filled. 

 

My question is: What should a formula look like in order for it to automatically fill in either 'daily' or 'Weekly' depending on what kind of task it is? 

I want this in order for the tasks to move to the right group again. 

Hope it makes sense. 

 

8 Replies 8

Skærmbillede 2022-12-19 kl. 14.48.27.png

I would do something along these lines.
IF(Daglig=1,"Daglig",
IF(Ugentlig=1,"Ugentlig",""))

Hi, @Mattthew 

Thanks a lot for your reply! 

I just tried, and I do see that for example 'Daglig' is added, but the Record still shows up on in 'Empty', so it adds it before the Record is re-made.

 

Skærmbillede 2022-12-19 kl. 15.12.43.png

I think I misunderstood your question and workflow, so ignore my formula.

You want the due date to be calculated, based on wether it is weekly or daily. Correct?

Also, why separate the completed check mark into daily and weekly? 

That's absolutely correct, yes! 

So when it calculates the due date, it moves the "old" Record to a "Done" view and re-makes the Record with the new due date. 

Regarding your second question; I think I ended up doing it that way because it's easier for my colleagues to choose. They don't like drop downs for some reason. They want it as easy as possible. 

I hope I get your workflow now. 

This workflow assumes that a) the task starts the day it is created, and b) there are only daily and weekly tasks. Your team will only mark weekly tasks. Otherwise, it is a daily task.

I would do the following changes:

1. Make a new field call it Created On. Column type is Created Time

2. Convert Deadline to a formula

3. paste the below formula into Deadline

IF({Ugentlig}=1,

DATESTR(DATEADD({Created On},7,'days')),
DATESTR(DATEADD({Created On},1,'days')))

4. convert Hyppighed to a formula and paste this formula
IF(IF({Ugentlig}=1,"Ugentlig","Daglig")

5. delete the Daglig column

Makes sense? I'm assuming you have more daily tasks than weekly tasks. 
But what happens when the task is complete? Or is that not something you need to worry about. 

Hello! 

When inserting the first formula (step 3), I get this: 

"Sorry, there was a problem saving this field. Invalid formula. Please check your formula text."

Can you help me figure out what the issue is?

It looks good to me.
Try to erase everything in the curly brackets { } and type the columns back in.

It could be a spelling mistake or something.

 

IF({}=1,

DATESTR(DATEADD({},7,'days')),
DATESTR(DATEADD({},1,'days')))