# IF Formula where X = an unidentified (but stable) number

All I want is that my clients be able to put an "x" in the tasks they want performed. Each has an associated cost, which I would like to sum in Q4 (I will be dragging the formula down through subsequent cells).

I know I will have to include "SUM" in the formula, but I cannot even get it to accept a second number added to the first:

``````=IF(G4 = "x", ".25"; H4 = "x" ".75"+G4)
``````

## 2 Answers

Use the following formula.

## Formula

``````=SUM(ARRAYFORMULA(IF(A3:F3="x",VALUE(RIGHT(A\$1:F\$1,4)))))
``````

## Explained

The `RIGHT` formula extracts the value from the title. The `VALUE` formula converts the string into a number. The `IF` formula will display the value, only if an `x` is present. The `ARRAYFORMULA` takes on the complete range and the `SUM` formula performs the summation.

## Example

I've created an example for you: SUM where X

The requirement crops up often and a function has been provided specifically for such purposes, SUMPRODUCT:

`````` =sumproduct(A\$2:P\$2,A3:P3="x")
``````

Assumes that there are values only in A2:P2 (say any descriptions for them moved to the row above).