Formula to VBA

  • Thread starter Thread starter Baapi
  • Start date Start date
B

Baapi

Hello there,

Can Some One please Help in Converting the following Formula to
Function?

C2 Contains "dd-mmm-yyyy hh:mm:ss"
Time A5 Contains 02:30:00
Time A21 Contains 17:30:00

=IF(AND(WEEKDAY(C2,2)>5,IF(WEEKDAY(C2,2)<6,IF(AND(TM(C2)>=Time!$A$5,TM(C2)<Time!$A$21),Time!$A$21,TM(C2)),IF(WEEKDAY(C2,2)<7,IF(TM(C2)>=Time!$A$5,Time!$A$21,TM(C2)),Time!$A$21))=Time!$A$21),INT(C2+2),INT(C2))

Thanks,
Baap
 
Couple of problems

This part

AND(WEEKDAY(C2,2)>5,IF(WEEKDAY(C2,2)<6

can never be true,

and what is TM

--

HTH

RP
(remove nothere from the email address if mailing direct)


Baapi said:
Hello there,

Can Some One please Help in Converting the following Formula to a
Function?

C2 Contains "dd-mmm-yyyy hh:mm:ss"
Time A5 Contains 02:30:00
Time A21 Contains 17:30:00
=IF(AND(WEEKDAY(C2,2)>5,IF(WEEKDAY(C2,2)<6,IF(AND(TM(C2)>=Time!$A$5,TM(C2)<T
 
Bob,

AND Function used is not between WEEKDAY(C2,2)>5 an
IF(WEEKDAY(C2,2)<6

But is between " WEEKDAY(C2,2)>5 " and

IF(WEEKDAY(C2,2)<6,IF(AND(TM(C2)>=Time!$A$5,TM(C2)<Time!$A$21),Time!$A$21,TM(C2)),IF(WEEKDAY(C2,2)<7,IF(TM(C2)>=Time!$A$5,Time!$A$21,TM(C2)),Time!$A$21))=Time!$A$2
"

and TM is a Add-In function that works a
"TIME(HOUR()<MINUTE()<SECOND())"

This should help!!
 

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

Back
Top