How can I choose multiple lines contain specific hours?

Kwnstantinos_M

New Member
Joined
Jun 12, 2018
Messages
24
Hello


Column A Column B
[TABLE="width: 500"]
<tbody>[TR]
[TD]1/1/2016 12:00:00 am[/TD]
[TD]yes[/TD]
[/TR]
[TR]
[TD]1/1/2016 3:00:00 am[/TD]
[TD]yes[/TD]
[/TR]
[TR]
[TD]1/1/2016 6:00:00 am[/TD]
[TD]yes[/TD]
[/TR]
[TR]
[TD]1/1/2016 9:00:00 am[/TD]
[TD]yes[/TD]
[/TR]
[TR]
[TD]1/1/2016 12:00:00 pm[/TD]
[TD]yes[/TD]
[/TR]
[TR]
[TD]1/1/2016 3:00:00 pm[/TD]
[TD]yes[/TD]
[/TR]
[TR]
[TD]1/1/2016 6:00:00 pm[/TD]
[TD]yes[/TD]
[/TR]
[TR]
[TD]1/1/2016 9:00:00 pm[/TD]
[TD]yes[/TD]
[/TR]
[TR]
[TD]2/1/2016 12:00:00 am[/TD]
[TD]yes[/TD]
[/TR]
[TR]
[TD]....etc[/TD]
[TD][/TD]
[/TR]
</tbody>[/TABLE]

****** id="cke_pastebin" style="position: absolute; top: 109px; width: 1px; height: 1px; overflow: hidden; left: -1000px;">[TABLE="width: 500"]
<tbody>[TR]
[TD]yes[/TD]
[/TR]
</tbody>[/TABLE]
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

Why are there 1,048,576 rows in Excel?
The Excel team increased the size of the grid in 2007. There are 2^20 rows and 2^14 columns for a total of 17 billion cells.
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,223,903
Messages
6,175,284
Members
452,630
Latest member
OdubiYouth

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