# Calculate column differently based on another column value

**URL:** <https://community.easymorph.com/t/calculate-column-differently-based-on-another-column-value/2039>\
**Category:** General Q&A\
**Created:** [August 4, 2020, 2:43pm UTC](https://community.easymorph.com/t/calculate-column-differently-based-on-another-column-value/2039 "2020-08-04T14:43:53Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Handelsbank.PB](https://community.easymorph.com/letter_avatar_proxy/v4/letter/h/439d5e/32.png) [@Handelsbank.PB](https://community.easymorph.com/u/Handelsbank.PB)\
**Post date:** [August 4, 2020, 2:43pm UTC](https://community.easymorph.com/t/calculate-column-differently-based-on-another-column-value/2039/1 "2020-08-04T14:43:53Z")

</div>

Dear all,

lets say I will have to calculate a column differently based on the value of another column.  
Would this be possible?

Example:  
Lets say I have a table like this

country | bank\_code  
GB | ABBY090222  
GB | BARC203253  
GB | ANTS090021  
DE | 70150000  
DE | 12030000  
DE | 70011110

Where **country = GB**  **bank\_code** should be calculated as **right([bank\_code],6)**.  
(It might be possible that there are more countries [at the moment up to 35 countries of a total of 99 countries may need special calculations] besides GB that need special and different calculations per country.)  
All not specified countries keep their original value.  
In this example: Where country = DE / bank\_code = bank\_code.

Best regards,  
Patrick

---

<div class="post-metadata">

**Author:** ![dgudkov](https://community.easymorph.com/user_avatar/community.easymorph.com/dgudkov/32/5_2.png) [@dgudkov](https://community.easymorph.com/u/dgudkov)\
**Post date:** [August 4, 2020, 2:58pm UTC](https://community.easymorph.com/t/calculate-column-differently-based-on-another-column-value/2039/2 "2020-08-04T14:58:06Z")

</div>

Hello Patrick,

the "Rule" action is intended exactly for that! You can create multiple IF/THEN conditions with that action.

See the example below:

[rule.morph](https://community.easymorph.com/uploads/short-url/a2WLB6qkmX1rV0aBjzrfO3Iz6lG.morph) (2.4 KB)

 ![image](https://community.easymorph.com/uploads/default/original/2X/4/4a30a11491d0b328482edcc66874a24341f8a4f7.png)
