I would like to run a function in Excel 2010 which has to:
Example:
In range B2:B227 there are some names, like Acura, Audi, BMW, Cadillac, etc. In range C2:C227 there are the number of cars those manufactures sold in 2012.
I want to calculate the sum of cars sold by certain manufacturers.
I was thinking about something similar, but it doesn't work. I think I made a mistake on the first step (recognize the names in cell B2:B227).
=SUMIF(B2:B227,OR("Audi","Acura","BMW","Cadillac"),D2:D227)
Thank you,
Gianluca
Sum if cell contains text If you are looking for an Excel formula to find cells containing specific text and sum the corresponding values in another column, use the SUMIF function. Where A2:A10 are the text values to check and B2:B10 are the numbers to sum. To sum with multiple criteria, use the SUMIFS function.
If you want, you can apply the criteria to one range and sum the corresponding values in a different range. For example, the formula =SUMIF(B2:B5, "John", C2:C5) sums only the values in the range C2:C5, where the corresponding cells in the range B2:B5 equal "John."
You can provide cell references as arguments of the SUMIFS function.
SUMIFS is a function to sum cells that meet multiple criteria. SUMIFS can be used to sum values when corresponding cells meet criteria based on dates, numbers, and text. SUMIFS supports logical operators (>,<,<>,=) and wildcards (*,?) for partial matching.
You can use SUMIF but as the result is an array (one sum for each criterion) you need to use SUM or SUMPRODUCT around the SUMIF to get the total, e.g.
=SUM(SUMIF(B2:B227,{"Audi","Acura","BMW","Cadillac"},D2:D227))
or list Audi, Acura etc in a range of cells e.g. K2:K5 and use this version
=SUMPRODUCT(SUMIF(B2:B227,K2:K5,D2:D227))
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With