Expand my Community achievements bar.

SOLVED

Need help with Calculation on a custom field

Avatar

Level 6

I have two Dropdown fields called 'Row' and 'Column' on my custom form. Field 'Row' holds the dropdown values 1,2,3,4,5,6,7,8 and Field 'Column' holds the dropdown values 1,2,3 and I need a calculated field called 'Total' with the below conditions:

 

The calculation of row + column should follow in this format:
Row 1 + Column 1 = 1
Row 1 +Column 2 = 2
Row 1 +Column 3 = 3
Row 2 +Column 1 = 4
Row 2 +Column 2 = 5
Row 2 +Column 3 = 6
Row 3 +Column 1 = 7
Row 3 +Column 2 = 8
Row 3 +Column 3 = 9
Row 4 +Column 1 = 10
Row 4 +Column 2 = 11
Row 4 +Column 3 = 12
Row 5 +Column 1 = 13
Row 5 +Column 2 = 14
Row 5 +Column 3 = 15
Row 6 +Column 1 = 16
Row 6 +Column 2 = 17
Row 6 +Column 3 = 18
Row 7 +Column 1 = 19
Row 7 +Column 2 = 20
Row 7 +Column 3 = 21
Row 8 +Column 1 = 22
Row 8 +Column 2 = 23
Row 8 +Column 3 = 24

 

Please advise!

Topics

Topics help categorize Community content and increase your ability to discover relevant content.

1 Accepted Solution

Avatar

Correct answer by
Level 6
 

To avoid a huge calculation which will not be scalable for any future changes, below is the pattern/formula that we came up with and works well with a short nested IF condition.

 

row=1, row*column

column=3, row*column

column=2, ((row*column)+(row-1))

column=1, ((column+1)row+(row-2))

 

Calculation:

if(row=1, row*column, if(column=3, row*column, if(column=2, ((row*column)+(row-1)), if(column=1, ((column+1)row+(row-2)), NA))))

View solution in original post

4 Replies

Avatar

Community Advisor

Given how clear your question was AI did spit out the answer I admit I didn't verify, but usually it's pretty good with calculated fields:

Rafal_Bainie_0-1742920923304.png

 

Avatar

Level 6

Thank you for this!

I will try this out, hope this works!

Avatar

Level 6

Only way is to have a big nested IF condition on the calculated field.

 

IF(field row = 1,IF(column=1,1,IF(column=2,2,IF(column=3,3,0))),
 IF(field row = 2,IF(column=1,4,IF(column=2,5,IF(column=3,6,0)))
 IF(field row = 3,IF(column=1,7,IF(column=2,8,IF(column=3,9,0)))
 IF(field row = 4,IF(column=1,10,IF(column=2,11,IF(column=3,12,0)))
 IF(field row = 5,IF(column=1,13,IF(column=2,14,IF(column=3,15,0)))
 IF(field row = 6,IF(column=1,16,IF(column=2,17,IF(column=3,18,0)))
 IF(field row = 7,IF(column=1,19,IF(column=2,20,IF(column=3,21,0)))
 IF(field row = 8,IF(column=1,22,IF(column=2,23,IF(column=3,24,0)))
 )))))))

Avatar

Correct answer by
Level 6
 

To avoid a huge calculation which will not be scalable for any future changes, below is the pattern/formula that we came up with and works well with a short nested IF condition.

 

row=1, row*column

column=3, row*column

column=2, ((row*column)+(row-1))

column=1, ((column+1)row+(row-2))

 

Calculation:

if(row=1, row*column, if(column=3, row*column, if(column=2, ((row*column)+(row-1)), if(column=1, ((column+1)row+(row-2)), NA))))