# Use formulas in columns

Fusion Tables supports creating a new column populated with the result of a formula on **numbers** in other columns.

To create a new formula column, choose **Edit** > **Add formula column**.

Supported formulas include:

- basic operations: + - * /
- functions:
`cos() sin() power(base, exponent)`

- logic:
`if (condition, then, else)`

Use column names in the formula. Add single quotes around column names that include spaces or special characters. Separate a list of items with commas.

The formula will use the first column it finds of that name. To use a later column with the same name, provide an index number. For example, 'Year(2)' refers to the second column with name Year.

#### Example: basic operations

Imagine a table with number columns for time and distance. The new column should show the average speed (distance / time) for each row.

time | distance |

5 | 50 |

4 | 48 |

Use **Edit > Add Formula** to create this new column. Name the new column “speed”. In the Formula box enter:

distance / time

then **Save**. The new column will contain the result of performing the formula for each row.

#### Example: logic

Imagine a table with star ratings from 1 to 5. You want to create a new column with a simpler rating: "1" if it has 4 or 5 stars, and "0" if it's not good. Remember formulas work with number columns, not text.

Here's the logic formula to write:

`if ('star rating' > 3, 1, 0)`