+ Reply to Thread
Results 1 to 3 of 3

Formula to VBA

  1. #1
    Registered User
    Join Date
    09-16-2005
    Location
    Bangalore, India
    Posts
    47

    Question Formula to VBA

    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)<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,
    Baapi

  2. #2
    Bob Phillips
    Guest

    Re: Formula to VBA

    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" <[email protected]> wrote in
    message news:[email protected]...
    >
    > 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
    ime!$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,
    > Baapi
    >
    >
    > --
    > Baapi
    > ------------------------------------------------------------------------
    > Baapi's Profile:

    http://www.excelforum.com/member.php...o&userid=27333
    > View this thread: http://www.excelforum.com/showthread...hreadid=477930
    >




  3. #3
    Registered User
    Join Date
    09-16-2005
    Location
    Bangalore, India
    Posts
    47

    Question

    Bob,

    AND Function used is not between WEEKDAY(C2,2)>5 and 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$21 "

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

    This should help!!!

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1