# How to create formula based on column value

I have a column in my SharePoint list named "Container Content." When adding a record in SharePoint you can choose one of three items in this column, it is a choice column. The three items you are able to choose are "Cases, Pallets, SlipSheet."I also have a column named "Content Amount." This column will tell us the amount of what the container content is. For example, if the container content is "cases" and the container amount is 980, then I have 980 cases. I have created a new calculated column that will need to take the value of the "container content" column and divide by 36 if it's Cases, divide by 32 of its pallets and divide by 10 if it's slip sheets. I have tried to create the formula but it is not working. I am a noob when it comes to formulas. I am hoping someone can help and/or stear me in the right direction.

Here is my code sample. `=IF([Container Content]="Cases"/36)+IF([Container Content]="Pallets"/32)+IF([Container Content]="Slip Sheets"/10)`

• I guess "Content Amount" column is number. So, You should be dividing Content amount column not container content. Why are you adding the values after dividing in formula.?please add more details in your question. – Ganesh Sanap Oct 17 '18 at 3:16
• Hi Ganesh, Yes, you're right. I've redone the code but it is still not working. I think this code snippet might provide more information as to the outcome I'm trying to accomplish. =IF([Container Content]="Cases" THEN [CONTENT AMOUNT] /96) IF([Container Content]="Pallets" THEN [CONTENT AMOUNT] /32) IF([Container Content]="Slip Sheets" THEN [CONTENT AMOUNT] /10) – Bertocious Oct 17 '18 at 19:07

## 1 Answer

Updating my answer,

First of all, make sure that the "Content Amount" field is of type "Number". Then use following formula for your calculated field:

``````=IF([Container Content]="Cases",[Content Amount]/96 , IF([Container Content]="Pallets",[Content Amount]/32,[Content Amount]/10))
``````

And return the calculated value as "Number".

Please upvote if this answer helped you in any way.

• Thank you Ganesh. I tried but it failed. I then looked at it more closely and saw it is missing the third attribute. I then edited the formula to the following but it still did not work. Something wrong with the syntax? =IF([Container Content]="Cases", [Content Amount]/96, (IF[Container Content]="Pallet",[Content Amount]/32, (IF[Container Content]='Slip Sheet', [Content Amount]/10))) – Bertocious Oct 18 '18 at 15:15
• I noticed something wrong in that formula. I fixed it in this one but I am still unable to get it to work. =IF([Container Content]="Cases",[Content Amount]/96, (IF[Container Content]="Pallet",[Content Amount]/32, (IF[Container Content]="'Slip Sheet", [Content Amount]/10))) – Bertocious Oct 18 '18 at 16:04
• @Bertocious Please refer the updated formula. – Ganesh Sanap Oct 19 '18 at 4:21
• Have you tried this? Is it worked for you? – Ganesh Sanap Oct 27 '18 at 17:34
• This is what got it working.... – Bertocious Nov 1 '18 at 16:52