Help

Re: IF Formula for measuring how many fields are valid per day

Solved
Jump to Solution
980 0
cancel
Showing results for 
Search instead for 
Did you mean: 
Greyson
6 - Interface Innovator
6 - Interface Innovator

Screen Shot 2019-08-12 at 2.48.42 PM.png

I’m tracking some healthy practices every day:

Exercise = Multiple Select (Running, Pushups, Squats)
Mediation = Duration
Healthy Food = Checkbox

And some negative practices:
Alcohol = Number

If Exercise is not empty, I want the Formula to return +1
If Meditation is greater than 0:10, I want the Formula to return +1
If Healthy Food is checked, I want the Formula to return +1

If 2 of these are True, I want to return 2
If 3 of these are True, I want to return 3

If alcohol is greater than 1, I want to subtract 1. So if all 3 positive behaviors were valid it would be 3 - 1 = 2

Then I will create a color filter and apply:

0 or -1 = red
1 = orange
2 = yellow
3 = green

I know this is a complex request, I appreciate any help you may be able to provide.

Thank you in advance

1 Solution

Accepted Solutions
JonathanBowen
13 - Mars
13 - Mars

Hi @Greyson - you can do it like this:

IF(Exercise, 1, 0) + IF(Meditation/60 > 10, 1, 0) + IF({Healthy Food}, 1, 0) + IF(Alcohol > 1, -1, 0)

Basically, counting each column as 1 if a value exists, except for Alcohol which is -1 if greater than one, then summing each value.

Screenshot 2019-08-13 at 15.59.01.png

There’s a bit of weird wrangling you need to do with the duration field - divide it by 60 to get an integer value, then compare to this (in your case 10, rather than 0:10)

JB

See Solution in Thread

2 Replies 2
JonathanBowen
13 - Mars
13 - Mars

Hi @Greyson - you can do it like this:

IF(Exercise, 1, 0) + IF(Meditation/60 > 10, 1, 0) + IF({Healthy Food}, 1, 0) + IF(Alcohol > 1, -1, 0)

Basically, counting each column as 1 if a value exists, except for Alcohol which is -1 if greater than one, then summing each value.

Screenshot 2019-08-13 at 15.59.01.png

There’s a bit of weird wrangling you need to do with the duration field - divide it by 60 to get an integer value, then compare to this (in your case 10, rather than 0:10)

JB

Greyson
6 - Interface Innovator
6 - Interface Innovator

@JonathanBowen this worked perfectly, thank you for your help.