Question

I'm working on adding a collection of board games to our library.

I have a spreadsheet that lists more games than I intend to buy, but have them there to investigate. I have the prices for a couple of websites listed beside each game.

The problem is that I want a sum that doesn't include every game on the list. Instead, I want to add a column at the front that if I put an "X" indicating this is a game to get, then I want it to add the value for that. Only the values for rows that start with an "X" in column A will in added together, instead of everything.

I was hoping to do this with a formula instead of just choosing a basic =SUM formula and selecting only a few cells at a time. I assume a =SUMIF might be the answer, but I have yet to figure out how to get this to work.

Was it helpful?

Solution

Please try:

=SUMIF(A:A,"x",B:B)  

where B:B is the column with the values. I suspect your difficulty may have been that when using text as the 'trigger' it needs to be in double inverted commas.

Or you might sort by ColumnA and just use =SUM as far down as there are xs.

Or filter on ColumnA to select x and Autosum ColumnB but change the 9 to 109.

OTHER TIPS

SUMIF requires at least 2 parameters, and at most 3. In your case, you will need to use 3.

If you type the formula in excel, you will see a little balloon indicating:

=SUMIF(Range, Criteria, [Sum_Range])

Range is the range where you want to apply the condition, in your case, A:A.

Criteria is the condition applied to the range, in your case "x".

[Sum_Range] is the range to sum, after applying the condition.

The above will sum all the cells in the range [Sum_Range], for which the cells of Range satisfies the condition Criteria.

Translating that into an actual formula, you get pnut's formula:

=SUMIF(A:A,"x",B:B)

The above will sum all the cells in the range B:B, for which the cells of A:A satisfies the condition x (SUMIF considers the criterion as being 'equal' so it will sum only when they are equal to the criteria).


As an extra, you can change the condition to mean 'not equal' by using something like this: =SUMIF(A:A,"<>x",B:B) (the <> means not equal to in Excel).

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top