ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   New Users to Excel (https://www.excelbanter.com/new-users-excel/)
-   -   adding values of cells (https://www.excelbanter.com/new-users-excel/171774-adding-values-cells.html)

AJ Patel

adding values of cells
 
I am trying to use a formula or function that will look at a cells say column
A check for a condition, if true, then add the value of another cell that is
on the same row to another cell. Yes I know that may be difficult to
understand so let me give you an example.

A B C D
1
2 dvd 25.23
3 cd 12.25
4 dvd 25.23
5 cd 12.25
6 bat 19.25

ok so what i want to do is look at column A, and look for any cells that
have dvd and add the corresponding value from column D to cell B1. So in
this case we can see the cell A2 and cell A4 is dvd so I want to add cells D2
and D4 and that value being placed in B1. Also, how could do the same thing
but look for multible conditions from column A, if i wanted to add the total
value of anything that has "dvd" and "cd" in Column A

T. Valko

adding values of cells
 
Try these:

For a single criteria:

=SUMIF(A2:A6,"dvd",D2:D6)

For multiple criteria:

=SUM(SUMIF(A2:A6,{"dvd","cd"},D2:D6))

--
Biff
Microsoft Excel MVP


"AJ Patel" <AJ wrote in message
...
I am trying to use a formula or function that will look at a cells say
column
A check for a condition, if true, then add the value of another cell that
is
on the same row to another cell. Yes I know that may be difficult to
understand so let me give you an example.

A B C D
1
2 dvd 25.23
3 cd 12.25
4 dvd 25.23
5 cd 12.25
6 bat 19.25

ok so what i want to do is look at column A, and look for any cells that
have dvd and add the corresponding value from column D to cell B1. So in
this case we can see the cell A2 and cell A4 is dvd so I want to add cells
D2
and D4 and that value being placed in B1. Also, how could do the same
thing
but look for multible conditions from column A, if i wanted to add the
total
value of anything that has "dvd" and "cd" in Column A




Max

adding values of cells
 
For multiple conditions, something like this:
=SUMPRODUCT((ISNUMBER(MATCH(A2:A100,{"dvd","cd"},0 )))*D2:D100)

For the single condition, use the simpler SUMIF, eg:
=SUMIF(A:A,"dvd",D:D)
--
Max
Singapore
http://savefile.com/projects/236895
xdemechanik
---
"AJ Patel" wrote:
I am trying to use a formula or function that will look at a cells say column
A check for a condition, if true, then add the value of another cell that is
on the same row to another cell. Yes I know that may be difficult to
understand so let me give you an example.

A B C D
1
2 dvd 25.23
3 cd 12.25
4 dvd 25.23
5 cd 12.25
6 bat 19.25

ok so what i want to do is look at column A, and look for any cells that
have dvd and add the corresponding value from column D to cell B1. So in
this case we can see the cell A2 and cell A4 is dvd so I want to add cells D2
and D4 and that value being placed in B1. Also, how could do the same thing
but look for multible conditions from column A, if i wanted to add the total
value of anything that has "dvd" and "cd" in Column A



All times are GMT +1. The time now is 01:25 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com