ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Worksheet Functions (https://www.excelbanter.com/excel-worksheet-functions/)
-   -   Add different values that equal 1 on a row (https://www.excelbanter.com/excel-worksheet-functions/197959-add-different-values-equal-1-row.html)

Add sum of different values

Add different values that equal 1 on a row
 
I am trying to add how many seat hours per equipment type each person has.
Which formula should I use? I've tried several and I get errors.

Example:

Crane type 3&4: how many times they have used this type of crane. I used
this formula but get 0 value instead of "3", which is the number of times in
the selection that the person used this specific type of equipment.

=SUMIF(D6:D41,"if(d6:d41{=3},{=4},1")

I am trying to assign a value of 1 to each cell that has a 3 or a 4 in it in
that specific range, so that when I add the range it will calculate how many
times they used either crane #3 or crane #4.

Thanks

PCLIVE

Add different values that equal 1 on a row
 
Maybe one way:

=COUNTIF(D6:D41,3)+COUNTIF(D6:D41,4)

HTH,
Paul

--

"Add sum of different values" <Add sum of different
wrote in message
...
I am trying to add how many seat hours per equipment type each person has.
Which formula should I use? I've tried several and I get errors.

Example:

Crane type 3&4: how many times they have used this type of crane. I used
this formula but get 0 value instead of "3", which is the number of times
in
the selection that the person used this specific type of equipment.

=SUMIF(D6:D41,"if(d6:d41{=3},{=4},1")

I am trying to assign a value of 1 to each cell that has a 3 or a 4 in it
in
that specific range, so that when I add the range it will calculate how
many
times they used either crane #3 or crane #4.

Thanks




Sandy Mann

Add different values that equal 1 on a row
 
Try:

=SUMPRODUCT(--(D6:D41={3,4}))

--
HTH

Sandy
In Perth, the ancient capital of Scotland
and the crowning place of kings


Replace @mailinator.com with @tiscali.co.uk


"Add sum of different values" <Add sum of different
wrote in message
...
I am trying to add how many seat hours per equipment type each person has.
Which formula should I use? I've tried several and I get errors.

Example:

Crane type 3&4: how many times they have used this type of crane. I used
this formula but get 0 value instead of "3", which is the number of times
in
the selection that the person used this specific type of equipment.

=SUMIF(D6:D41,"if(d6:d41{=3},{=4},1")

I am trying to assign a value of 1 to each cell that has a 3 or a 4 in it
in
that specific range, so that when I add the range it will calculate how
many
times they used either crane #3 or crane #4.

Thanks






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

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