Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 89
Default return a result from multiple conditions.

Is there one formula that will do the following?
A1:A3 = 7/9/2007 AND column C1:C3 =IN, then count (ADD) B1:B3
BUT if column C1:C3 = DD then subtract from the count of B1:B3
AND if colmun C1:C3 = OT then subtract from the count of B1:B3.

date count in/ot/dd
7/9/2007 10 IN
7/9/2007 1 DD
7/9/2007 8 OT

Example: +10 "IN" - 1 "DD" + 8 "OT" would = 1 on 6/27/07
Excel 2003, Thanks.
  #2   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 964
Default return a result from multiple conditions.

This should do the trick:

=SUMPRODUCT(--(A1:A3=DATE(2007,7,9)),IF(C1:C3="IN",B1:B3,IF(C1:C 3="DD",-(B1:B3),IF(C1:C3="OT",-(B1:B3),0))))

Enter this as an array formula. Press CTRL-SHIFT-ENTER instead of just
Enter. If done properly, the formula should be enclosed in { }.

HTH,
Elkar


"Christy" wrote:

Is there one formula that will do the following?
A1:A3 = 7/9/2007 AND column C1:C3 =IN, then count (ADD) B1:B3
BUT if column C1:C3 = DD then subtract from the count of B1:B3
AND if colmun C1:C3 = OT then subtract from the count of B1:B3.

date count in/ot/dd
7/9/2007 10 IN
7/9/2007 1 DD
7/9/2007 8 OT

Example: +10 "IN" - 1 "DD" + 8 "OT" would = 1 on 6/27/07
Excel 2003, Thanks.

  #3   Report Post  
Posted to microsoft.public.excel.worksheet.functions
bj bj is offline
external usenet poster
 
Posts: 1,397
Default return a result from multiple conditions.

amung others
=sumproduct(--(A1:A3=date(2007,7,9)),--(C1:C3="IN)-(c1:C3="DD")-(C1:C3="OT"), B1:B3)

or

=sumif(C1:C3,"IN",B1:B3)-Sumif(C1:C3,"DD",B1:B3)-sumif(C1:C3,"OT",B1:B3)

"Christy" wrote:

Is there one formula that will do the following?
A1:A3 = 7/9/2007 AND column C1:C3 =IN, then count (ADD) B1:B3
BUT if column C1:C3 = DD then subtract from the count of B1:B3
AND if colmun C1:C3 = OT then subtract from the count of B1:B3.

date count in/ot/dd
7/9/2007 10 IN
7/9/2007 1 DD
7/9/2007 8 OT

Example: +10 "IN" - 1 "DD" + 8 "OT" would = 1 on 6/27/07
Excel 2003, Thanks.

  #4   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 89
Default return a result from multiple conditions.

I've entered this, double checked my entry 2x but it says I have a formula
problem. Any suggestions?

"Elkar" wrote:

This should do the trick:

=SUMPRODUCT(--(A1:A3=DATE(2007,7,9)),IF(C1:C3="IN",B1:B3,IF(C1:C 3="DD",-(B1:B3),IF(C1:C3="OT",-(B1:B3),0))))

Enter this as an array formula. Press CTRL-SHIFT-ENTER instead of just
Enter. If done properly, the formula should be enclosed in { }.

HTH,
Elkar


"Christy" wrote:

Is there one formula that will do the following?
A1:A3 = 7/9/2007 AND column C1:C3 =IN, then count (ADD) B1:B3
BUT if column C1:C3 = DD then subtract from the count of B1:B3
AND if colmun C1:C3 = OT then subtract from the count of B1:B3.

date count in/ot/dd
7/9/2007 10 IN
7/9/2007 1 DD
7/9/2007 8 OT

Example: +10 "IN" - 1 "DD" + 8 "OT" would = 1 on 6/27/07
Excel 2003, Thanks.

  #5   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 964
Default return a result from multiple conditions.

I double checked, and there aren't any errors in the formula I posted, you
must have missed something somewhere. But, give one of BJ's solutions a try.
Aside from a missing quotation mark in the first one, they should both work
as well.

HTH,
Elkar


"Christy" wrote:

I've entered this, double checked my entry 2x but it says I have a formula
problem. Any suggestions?

"Elkar" wrote:

This should do the trick:

=SUMPRODUCT(--(A1:A3=DATE(2007,7,9)),IF(C1:C3="IN",B1:B3,IF(C1:C 3="DD",-(B1:B3),IF(C1:C3="OT",-(B1:B3),0))))

Enter this as an array formula. Press CTRL-SHIFT-ENTER instead of just
Enter. If done properly, the formula should be enclosed in { }.

HTH,
Elkar


"Christy" wrote:

Is there one formula that will do the following?
A1:A3 = 7/9/2007 AND column C1:C3 =IN, then count (ADD) B1:B3
BUT if column C1:C3 = DD then subtract from the count of B1:B3
AND if colmun C1:C3 = OT then subtract from the count of B1:B3.

date count in/ot/dd
7/9/2007 10 IN
7/9/2007 1 DD
7/9/2007 8 OT

Example: +10 "IN" - 1 "DD" + 8 "OT" would = 1 on 6/27/07
Excel 2003, Thanks.

Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
how to return a result from 2 conditions? Christy Excel Worksheet Functions 2 July 9th 07 04:42 PM
Multiple conditions and multiple return values Minerva Excel Worksheet Functions 3 February 16th 06 06:57 AM
How do I set up multiple logical conditions on one result cell Ring eye Excel Worksheet Functions 1 January 12th 06 07:31 PM
2 Conditions True, Many Variables, Return Result elliekev26 Excel Worksheet Functions 4 September 22nd 05 04:16 PM
How do I check the conditions of 2 fields to return a result Jimbob Excel Discussion (Misc queries) 3 January 17th 05 11:59 AM


All times are GMT +1. The time now is 05:12 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"