# Help Creating a "Case Function", I believe?

Question asked by fredmckinnon on Feb 6, 2010
Latest reply on Feb 6, 2010 by beckett85_1

### Title

Help Creating a "Case Function", I believe?

### Post

Hey Gang,

Trying to create more complex functions is over my head.  I *THINK* what I'm trying to do is create a "case" function, based on a series of tests.

I'm building a database to host the Net P&L on an e-biz ... and the Net P&L is calculated different based on what marketplace an item sell in.

Some marketplaces have the merchant fee built-in, but others where we use our own merchant processing have the fee as a separate transaction.  I'm trying to build a function that will calculate the "Merchant Fee" field, when there is one.

Marketplace Field:
Store1

Store2

Store3 *

Store4 *

*Store3 and Store4 have a merchant fee added to the transaction.

How do I build the function so that I am saying:
If the Marketplace Field is = Store3 or Store4, the merchant fee is the Gross * .029 + \$.30, and if the Marketplace Field is Store1 or Store2, the merchant fee = \$0

In other words ... using 3 fields:
Marketplace
Gross (total money on the order)
Merchant Fee (calculation of 2.9% plus \$.30, but ONLY if the Marketplace Field is one of the Stores that incur a merchant fee)

I hope that makes sense.  If someone could help write out the formula below, I'd be very grateful!