how do i use contains in an if statement

P

Pondering

I have data that exports in this format
4/30/2007 07:00:00
4/30/2007 15:00:00
4/30/2007 23:00:00
I'm not sure if it matters but if you actually click on the cell it also
shows AM or PM. I need an If then statement that will tell me if ex
IF A1 contains 07:00:00 then "1ST", If A1 contains 15:00:00 then "2ND",else
"3rd"

I can't get the formats right, thanks for your help!
 
T

Toppers

this ?

=IF(ROUND(MOD(A1,1),7)=ROUND(TIME(7,0,0),7),"1st",IF(ROUND(MOD(A1,1),7)=ROUND(TIME(15,0,0),7),"2nd","3rd"))
 
C

Chad Borman

Try this:

=IF(HOUR(C1)=7,"first",IF(HOUR(C1)=15,"second","third"))

C1 refers to the cell containing your date/time value.
 
T

Toppers

.....dooh! What a dumb response!

Toppers said:
this ?

=IF(ROUND(MOD(A1,1),7)=ROUND(TIME(7,0,0),7),"1st",IF(ROUND(MOD(A1,1),7)=ROUND(TIME(15,0,0),7),"2nd","3rd"))
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top