Mar 07, 2022 05:00 PM
I am trying to automate the calculation of an award based on an age category (“PVSA Age Group”) and a number of hours volunteered (“Total PVSA Hrs.”) (see chart). I think I need nested IF statements with an AND, but not sure. It’s not working so far (because I have a day job hello.) I need an output based on these two variables.
Here is the first part of my formula, attacking only the second row (we have no contenders for KID category in the first row, just the remaining 3 rows):
IF(
AND(
{PVSA Age Group}=“Teens”,
{Total PVSA Hrs}<50
),
“No award”
) &
IF(
AND(
{PVSA Age Group}="Teens”,
{Total PVSA Hrs}<=74
),
“Bronze”
)&
IF(
AND(
{PVSA Age Group}="Teens”,
{Total PVSA Hrs}<= 99
),
“Silver”
),
“Gold”
That doesn’t work. Once I get it working, I need to figure out how to concatenate the other two rows (for different age categories.). Do I eliminate the subsequent AND statements, to save them for the concatenation?
Solved! Go to Solution.
Mar 08, 2022 09:40 AM
It’s always a pleasure, glad it worked as intended.
The idea of nested IFs is that the FALSE value is also an IF statement. so basically after the TRUE value you just open another IF statement, but it gets complicated with all the brackets. What I personally do is write each Argument on a separate line and then count them :grinning_face_with_big_eyes:
This full formula should be as follows
IF(AND({PVSA Age Group}="Teens",{Total PVSA Hrs}<50),"No Award",
IF(AND({PVSA Age Group}="Teens",{Total PVSA Hrs}<=74),"Bronze",
IF(AND({PVSA Age Group}="Teens",{Total PVSA Hrs}<=99),"Silver",
IF({PVSA Age Group}="Teens", "Gold",
IF(AND({PVSA Age Group}="Adults",{Total PVSA Hrs}<100),"No Award",
IF(AND({PVSA Age Group}="Adults",{Total PVSA Hrs}<=249),"Bronze",
IF(AND({PVSA Age Group}="Adults",{Total PVSA Hrs}<=499),"Silver",
IF({PVSA Age Group}="Adults","Gold",
IF(AND({PVSA Age Group}="Young Adults",{Total PVSA Hrs}<100),"No Award",
IF(AND({PVSA Age Group}="Young Adults",{Total PVSA Hrs}<=174),"Bronze",
IF(AND({PVSA Age Group}="Young Adults",{Total PVSA Hrs}<=249),"Silver",
IF({PVSA Age Group}="Young Adults","Gold"))))))))))))
Mar 07, 2022 09:31 PM
Hi @Valerie_Miles ,
There are several reasons the formula is not working.
First of all, you cannot use “&” for the IF Statement unless you are meaning to concatenate the results (which I dont think you are?).
The formula should look like this instead
IF(AND({PVSA Age Group}="Teens",{Total PVSA Hrs}<50),"No Award",
(IF(AND({PVSA Age Group}="Teens",{Total PVSA Hrs}<=74),"Bronze",
IF(AND({PVSA Age Group}="Teens",{Total PVSA Hrs}<=99),"Silver",
"Gold"))))
Mar 08, 2022 09:13 AM
You are absolutely correct. I did not want to concatenate. Thank you. How to add (not an &!) the condition if the PVSA Age Group is “Young Adults” or “Adults”? The other formulas to be part of the decision are:
for Young Adults:
IF(AND({PVSA Age Group}=“Young Adults",{Total PVSA Hrs}<100),”No Award",
(IF(AND({PVSA Age Group}=“Young Adults”,{Total PVSA Hrs}<=174),”Bronze",
IF(AND({PVSA Age Group}=“Young Adults",{Total PVSA Hrs}<=249),”Silver",
“Gold”))))
and for Adults:
IF(AND({PVSA Age Group}=“Adults”,{Total PVSA Hrs}<100),”No Award",
(IF(AND({PVSA Age Group}=“Adults”,{Total PVSA Hrs}<=249),”Bronze",
IF(AND({PVSA Age Group}=“Adults”,{Total PVSA Hrs}<=499),”Silver",
“Gold”))))
How to nest these IF statements with the one you polished up for me? Thank you, I will Venmo you coffee money!
My CURRENT INEFFICIENT WORK AROUND which drives me nuts is:
Mar 08, 2022 09:40 AM
It’s always a pleasure, glad it worked as intended.
The idea of nested IFs is that the FALSE value is also an IF statement. so basically after the TRUE value you just open another IF statement, but it gets complicated with all the brackets. What I personally do is write each Argument on a separate line and then count them :grinning_face_with_big_eyes:
This full formula should be as follows
IF(AND({PVSA Age Group}="Teens",{Total PVSA Hrs}<50),"No Award",
IF(AND({PVSA Age Group}="Teens",{Total PVSA Hrs}<=74),"Bronze",
IF(AND({PVSA Age Group}="Teens",{Total PVSA Hrs}<=99),"Silver",
IF({PVSA Age Group}="Teens", "Gold",
IF(AND({PVSA Age Group}="Adults",{Total PVSA Hrs}<100),"No Award",
IF(AND({PVSA Age Group}="Adults",{Total PVSA Hrs}<=249),"Bronze",
IF(AND({PVSA Age Group}="Adults",{Total PVSA Hrs}<=499),"Silver",
IF({PVSA Age Group}="Adults","Gold",
IF(AND({PVSA Age Group}="Young Adults",{Total PVSA Hrs}<100),"No Award",
IF(AND({PVSA Age Group}="Young Adults",{Total PVSA Hrs}<=174),"Bronze",
IF(AND({PVSA Age Group}="Young Adults",{Total PVSA Hrs}<=249),"Silver",
IF({PVSA Age Group}="Young Adults","Gold"))))))))))))
Mar 08, 2022 10:40 AM
This works! And is much more elegant than my 4 extra columns for the single solution. I was so close. Thank you for the foundational knowledge that I can apply to future formulas. Now let me know how to Venmo you a coffee. Thank you very much Mohamed.