You are viewing limited content. For full access, please sign in.

Question

Question

Summing on Expense Report Based on Check Box Yes/No

asked on March 19, 2019

On our expense report I have a check box for Company Visa and if it isn't checked it is a regular expense.  To keep employees from filling out 2 different expense reports, I would like to put a check box on the form for them to mark if it is a visa expense or not.  If it is a visa expense I want it totaled separately from other expenses.  I want the expenses that aren't visa to be totaled to together.

 

I've attached what I've done so far if I could get some help, this is my first week using forms and I don't know CSS (I'm willing to use it if that is the solution). 

0 0

Answer

SELECTED ANSWER
replied on March 19, 2019 Show version history

There's actually a much easier way to do this using only Functions instead of JavaScript like the linked example.

You would have two total fields, one for "Visa" and one for "Non-Visa" and you use a SUMIF function instead of a SUM function.

Visa Total Function

=SUMIF(Expenses.Company_Visa,"Yes",Expenses.Amount)

 

Non-Visa Total Function

=SUMIF(Expenses.Company_Visa,"No",Expenses.Amount)

 

 

On a separate note, you might want to consider using a Currency field type instead of a Number type for the Amount. If you do change it, make sure to check your variable names afterward.

Also, don't forget to make your Total fields Read-Only, the functions will still work and it will prevent users from messing with the values.

2 0

Replies

replied on March 19, 2019
0 0
SELECTED ANSWER
replied on March 19, 2019 Show version history

There's actually a much easier way to do this using only Functions instead of JavaScript like the linked example.

You would have two total fields, one for "Visa" and one for "Non-Visa" and you use a SUMIF function instead of a SUM function.

Visa Total Function

=SUMIF(Expenses.Company_Visa,"Yes",Expenses.Amount)

 

Non-Visa Total Function

=SUMIF(Expenses.Company_Visa,"No",Expenses.Amount)

 

 

On a separate note, you might want to consider using a Currency field type instead of a Number type for the Amount. If you do change it, make sure to check your variable names afterward.

Also, don't forget to make your Total fields Read-Only, the functions will still work and it will prevent users from messing with the values.

2 0
replied on March 19, 2019

I think I’ll try this when I get back into work. Thank you.

0 0
replied on March 20, 2019

Thank you.  That worked PERFECTLY!

0 0
You are not allowed to follow up in this post.

Sign in to reply to this post.