How can I choose multiple lines contain specific hours?

Kwnstantinos_M

New Member
Joined
Jun 12, 2018
Messages
24
Hello


Column A Column B
1/1/2016 12:00:00 amyes
1/1/2016 3:00:00 amyes
1/1/2016 6:00:00 amyes
1/1/2016 9:00:00 amyes
1/1/2016 12:00:00 pmyes
1/1/2016 3:00:00 pmyes
1/1/2016 6:00:00 pmyes
1/1/2016 9:00:00 pmyes
2/1/2016 12:00:00 amyes
....etc

<tbody>
</tbody>

****** id="cke_pastebin" style="position: absolute; top: 109px; width: 1px; height: 1px; overflow: hidden; left: -1000px;">
yes

<tbody>
</tbody>
I have the above table. I want to find which cells (rows) contain specific hours. To do so I used the if function:

PHP:
=IF(B2=HOUR("12:00:00");"xx";"yes")

The outcome was not correct. As you can see the outcome was "yes" corresponding to false.. What is the problem?

In addition, I tried to embed the "and" function, in order to select multiple hours, but the excel prompt error message. The formula I tried in cell B2 is:

Code:
=IF(B2=HOUR(AND("12:00:00";"3:00:00");"xx";"yes"))

message: contain many conditions
 
Last edited:

Excel Facts

Create a Pivot Table on a Map
If your data has zip codes, postal codes, or city names, select the data and use Insert, 3D Map. (Found to right of chart icons).
Try:
=IF(HOUR(B2)=12,"xx","yes")

=IF(OR(HOUR(B2)=12,HOUR(B2)=3),"xx","yes")
 
Last edited:
Upvote 0

Forum statistics

Threads
1,216,116
Messages
6,128,929
Members
449,479
Latest member
nana abanyin

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