Better Formula Needed

AnilPullagura

Board Regular
Joined
Nov 19, 2010
Messages
98
Hi Pros,

I have deduced a formula(kinda rough) to get my immediate request fullfilled. Now, I want to if there could be a better one to replace this not so perfect formula.

I feel there should be a good array formula to replace the below crude formula.

Code:
IF(COUNTIFS(Sheet1!$B$2:$B$65000,$B4,Sheet1!$D$2:$D$65000,"RHC",Sheet1!$E$2:$E$65000,"Completed")+
COUNTIFS(Sheet1!$B$2:$B$65000,$B4,Sheet1!$D$2:$D$65000,"Outpatient",Sheet1!$E$2:$E$65000,"Completed")=0,"",
COUNTIFS(Sheet1!$B$2:$B$65000,$B4,Sheet1!$D$2:$D$65000,"RHC",Sheet1!$E$2:$E$65000,"Completed")+
COUNTIFS(Sheet1!$B$2:$B$65000,$B4,Sheet1!$D$2:$D$65000,"Outpatient",Sheet1!$E$2:$E$65000,"Completed"))

Thanks,
Anil
Excel is more than an Ocean. It's always a Learning
 

Excel Facts

How can you turn a range sideways?
Copy the range. Select a blank cell. Right-click, Paste Special, then choose Transpose.
Hi Pros,

I have deduced a formula(kinda rough) to get my immediate request fullfilled. Now, I want to if there could be a better one to replace this not so perfect formula.

I feel there should be a good array formula to replace the below crude formula.

Code:
IF(COUNTIFS(Sheet1!$B$2:$B$65000,$B4,Sheet1!$D$2:$D$65000,"RHC",Sheet1!$E$2:$E$65000,"Completed")+
COUNTIFS(Sheet1!$B$2:$B$65000,$B4,Sheet1!$D$2:$D$65000,"Outpatient",Sheet1!$E$2:$E$65000,"Completed")=0,"",
COUNTIFS(Sheet1!$B$2:$B$65000,$B4,Sheet1!$D$2:$D$65000,"RHC",Sheet1!$E$2:$E$65000,"Completed")+
COUNTIFS(Sheet1!$B$2:$B$65000,$B4,Sheet1!$D$2:$D$65000,"Outpatient",Sheet1!$E$2:$E$65000,"Completed"))

Thanks,
Anil
Excel is more than an Ocean. It's always a Learning

Try...
Code:
=SUM(COUNTIFS(
    Sheet1!$B$2:$B$65000,$B4,
    Sheet1!$D$2:$D$65000,{"RHC","Outpatient"},
    Sheet1!$E$2:$E$65000,"Completed"))

Custom format the formula cell as e.g.: [=0]"";General
 
Upvote 0
Thanks Aladin, it worked,

However I have more criteria than just RHC and Outpatient, Can we have any better array formula...., that i need not hardcode..., and can dynamically do...

Help needed...

Thanks,
Anil
 
Upvote 0
Thanks Aladin, it worked,

However I have more criteria than just RHC and Outpatient, Can we have any better array formula...., that i need not hardcode..., and can dynamically do...

Help needed...

Thanks,
Anil

Create a range housing the relevant criteria like RHC, Outpatient, etc. Name this range CritList, and invoke:

Code:
=SUMPROPDUCT(COUNTIFS(
    Sheet1!$B$2:$B$65000,$B4,
    Sheet1!$D$2:$D$65000,CritList,
    Sheet1!$E$2:$E$65000,"Completed"))
 
Upvote 0
Thanks Aladin, it worked,

However I have more criteria than just RHC and Outpatient, Can we have any better array formula...., that i need not hardcode..., and can dynamically do...

Help needed...

Thanks,
Anil
Use cells to hold the criteria:
  • A2 = RHC
  • A3 = Outpatient
  • B2 = Completed
Then:

=SUMPRODUCT(--(Sheet1!B2:B65000=B4),--(ISNUMBER(MATCH(Sheet1!D2:D65000,A2:A3,0))),--(Sheet1!E2:E65000=B2))
 
Upvote 0

Forum statistics

Threads
1,224,606
Messages
6,179,862
Members
452,948
Latest member
UsmanAli786

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top