COUNT IF Function Help

KuraiChikara

Board Regular
Joined
Nov 16, 2016
Messages
111
Office Version
  1. 2013
Platform
  1. Windows
Hello,
I am simply trying to use a COUNTIF function to find a lesser than or equal to result for time.

Example: I have the times 5:00 PM through 9:00 AM (descending) listed in column C. And lets say for testing purposes the exact same time frames in column B for the range.

This formula below will return a 1 if 5:00 PM is listed once in cells B2-B10.
=COUNTIF(B$2:B$10,C2)

However, if B3-B10 has the times 4:00 PM, 3:00 PM, 2:00 PM, 1:00 PM, 12:00 PM, 11:00 AM, 10:00 AM and 9:00 AM

with my less than or equal to formula returns a zero:
=COUNTIF(B$2:B$10,"<=C2")

I'm simply trying to yield the same results just by adding the less than or equal to function; 5:00 pm is less than or equal to 5:00 PM, I should get a 1. 12:00 PM is less than or equal to 5:00 PM, should yield a 1. So on and so forth.

But my formula returns 0.
 

Excel Facts

What does custom number format of ;;; mean?
Three semi-colons will hide the value in the cell. Although most people use white font instead.
That works thank you. It actually does more of what I was looking for. There are 8 other time frames under 5:00 PM (9 including 5:00 PM) and your formula gives me 9.

One more question, what does the ampersand do to make this work?
 
Upvote 0
That works thank you. It actually does more of what I was looking for. There are 8 other time frames under 5:00 PM (9 including 5:00 PM) and your formula gives me 9.
Do you have a blank cell in the range as that would also evaluate to less than your time-of-interest?


One more question, what does the ampersand do to make this work?
It appends the value in cell C2 to the "<=" text. The way you had it written, "<=C2" is just a literal text string and has nothing to do with cell C2.
 
Upvote 0

Forum statistics

Threads
1,216,098
Messages
6,128,812
Members
449,468
Latest member
AGreen17

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