If & COUNTIF Statements for Productivity

tspehar21

New Member
Joined
Mar 20, 2019
Messages
1
For my work my productivity is tracked and recorded, however the database software our company uses is garbage and I have an excel spreadsheet that I prefer to use.

So what I track is:
  • Encounter #
  • If it is a NB (NewBorn), Y for yes, nothing if not
  • The LOS (Length Of Stay), #

Depending on the LOS and if it is a NB or not, will depict how many minutes you are allotted for that encounter. For instance a 1-3 day LOS you are given 32.5 min, whereas a 1-3 day LOS NB you are given 22.5 min.

What I want to be able to do is have excel count up how many 1-3 day LOS encounters I have for the week, how many 1-3 day NB LOS encounters, 4-6 day LOS, etc.

I was thinking that this would involve an IF statement to determine if column 2 has a "Y" making it a NB encounter, and then the COUNTIF statement to count how many encounters are 1-3 day LOS (Column 3).

[TABLE="class: outer_border, width: 500"]
<tbody>[TR]
[TD]Encounter#[/TD]
[TD]NB[/TD]
[TD]LOS[/TD]
[/TR]
[TR]
[TD]23456[/TD]
[TD][/TD]
[TD]2[/TD]
[/TR]
[TR]
[TD]34567[/TD]
[TD]Y[/TD]
[TD]1[/TD]
[/TR]
[TR]
[TD]45678[/TD]
[TD]Y[/TD]
[TD]2[/TD]
[/TR]
[TR]
[TD]56789[/TD]
[TD][/TD]
[TD]3[/TD]
[/TR]
[TR]
[TD]67890[/TD]
[TD]Y[/TD]
[TD]2[/TD]
[/TR]
[TR]
[TD]78901[/TD]
[TD]Y[/TD]
[TD]1[/TD]
[/TR]
[TR]
[TD]89012[/TD]
[TD]Y[/TD]
[TD]1[/TD]
[/TR]
[TR]
[TD]90123[/TD]
[TD][/TD]
[TD]4[/TD]
[/TR]
[TR]
[TD]01234[/TD]
[TD][/TD]
[TD]3[/TD]
[/TR]
</tbody>[/TABLE]

For the above table, there are:
5x 1-3 day LOS NB encounters, (1, 2, 2, 1, 1)
3x 1-3 day LOS encounters (2, 3, 3)
1x 4-6 day LOS encounters (4)

How would you write a formula that would be able to Count each of the above values? I realize I would need a separate formula for each value range, 1-3 day LOS, 1-3 day LOS NB, 4-6 day LOS. Would I have to have a separate formula for 1 day LOS, 2 day LOS, 3 day LOS, then SUM those values? I need to be able to keep the NB encounters separate from the normal ones as they are given a different amount of time, hence my thought for the IF statement. Please let me know what you think.
 

Excel Facts

How to fill five years of quarters?
Type 1Q-2023 in a cell. Grab the fill handle and drag down or right. After 4Q-2023, Excel will jump to 1Q-2024. Dash can be any character.
Welcome to Mr Excel forum

Try something like this

[Table="class: grid"][tr][td="bgcolor: #DCE6F1"][/td][td="bgcolor: #DCE6F1"]
A
[/td][td="bgcolor: #DCE6F1"]
B
[/td][td="bgcolor: #DCE6F1"]
C
[/td][td="bgcolor: #DCE6F1"]
D
[/td][td="bgcolor: #DCE6F1"]
E
[/td][td="bgcolor: #DCE6F1"]
F
[/td][td="bgcolor: #DCE6F1"]
G
[/td][td="bgcolor: #DCE6F1"]
H
[/td][/tr]
[tr][td="bgcolor: #DCE6F1"]
1
[/td][td]
Encounter#​
[/td][td]
NB​
[/td][td]
LOS​
[/td][td][/td][td]
DaysMin​
[/td][td]
DaysMax​
[/td][td]
NB Y?​
[/td][td]
Result​
[/td][/tr]

[tr][td="bgcolor: #DCE6F1"]
2
[/td][td]
23456​
[/td][td][/td][td]
2​
[/td][td][/td][td]
1​
[/td][td]
3​
[/td][td]
Y​
[/td][td]
5​
[/td][/tr]

[tr][td="bgcolor: #DCE6F1"]
3
[/td][td]
34567​
[/td][td]
Y​
[/td][td]
1​
[/td][td][/td][td]
1​
[/td][td]
3​
[/td][td][/td][td]
3​
[/td][/tr]

[tr][td="bgcolor: #DCE6F1"]
4
[/td][td]
45678​
[/td][td]
Y​
[/td][td]
2​
[/td][td][/td][td]
4​
[/td][td]
6​
[/td][td]
Y​
[/td][td]
0​
[/td][/tr]

[tr][td="bgcolor: #DCE6F1"]
5
[/td][td]
56789​
[/td][td][/td][td]
3​
[/td][td][/td][td]
4​
[/td][td]
6​
[/td][td][/td][td]
1​
[/td][/tr]

[tr][td="bgcolor: #DCE6F1"]
6
[/td][td]
67890​
[/td][td]
Y​
[/td][td]
2​
[/td][td][/td][td][/td][td][/td][td][/td][td][/td][/tr]

[tr][td="bgcolor: #DCE6F1"]
7
[/td][td]
78901​
[/td][td]
Y​
[/td][td]
1​
[/td][td][/td][td][/td][td][/td][td][/td][td][/td][/tr]

[tr][td="bgcolor: #DCE6F1"]
8
[/td][td]
89012​
[/td][td]
Y​
[/td][td]
1​
[/td][td][/td][td][/td][td][/td][td][/td][td][/td][/tr]

[tr][td="bgcolor: #DCE6F1"]
9
[/td][td]
90123​
[/td][td][/td][td]
4​
[/td][td][/td][td][/td][td][/td][td][/td][td][/td][/tr]

[tr][td="bgcolor: #DCE6F1"]
10
[/td][td]
1234​
[/td][td][/td][td]
3​
[/td][td][/td][td][/td][td][/td][td][/td][td][/td][/tr]
[/table]


Criteria in columns E:G

Formula in H2 copied down
=COUNTIFS(C$2:C$10,">="&E2,C$2:C$10,"<="&F2,B$2:B$10,IF(G2="","",G2))

Hope this helps

M.
 
Upvote 0

Forum statistics

Threads
1,223,907
Messages
6,175,300
Members
452,633
Latest member
DougMo

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