Home |
Search |
Today's Posts |
|
#1
![]()
Posted to microsoft.public.excel.misc
|
|||
|
|||
![]()
is there any way to do this using VBA?
=-(IF(AND(WEEKDAY(A1,2)<6,MOD(A1,1)17/24),1,0)+WEEKDAY(A1,2)6)+2*(IF (AND( WEEKDAY(A1,2)<6,MOD(A1,1)17/24),1,0)+WEEKDAY(A1,2)5)+A1 thanks |
#2
![]()
Posted to microsoft.public.excel.misc
|
|||
|
|||
![]()
Sure. What does it do and why ?
Best wishes Harald "Savio" wrote in message ... is there any way to do this using VBA? =-(IF(AND(WEEKDAY(A1,2)<6,MOD(A1,1)17/24),1,0)+WEEKDAY(A1,2)6)+2*(IF (AND( WEEKDAY(A1,2)<6,MOD(A1,1)17/24),1,0)+WEEKDAY(A1,2)5)+A1 thanks |
#3
![]()
Posted to microsoft.public.excel.misc
|
|||
|
|||
![]()
Savio,
Sure. Just process the formula with Format and Evaluate: MsgBox Format(Evaluate("-(IF(AND(WEEKDAY(A1,2)<6,MOD(A1,1)17/24),1,0)" & _ "+WEEKDAY(A1,2)6)+2*(IF(AND(WEEKDAY(A1,2)<6,MOD(A 1,1)17/24),1,0)" & _ "+WEEKDAY(A1,2)5)+A1"), "mmmm dd, yyyy") HTH, Bernie MS Excel MVP "Savio" wrote in message ... is there any way to do this using VBA? =-(IF(AND(WEEKDAY(A1,2)<6,MOD(A1,1)17/24),1,0)+WEEKDAY(A1,2)6)+2*(IF (AND( WEEKDAY(A1,2)<6,MOD(A1,1)17/24),1,0)+WEEKDAY(A1,2)5)+A1 thanks |
#4
![]()
Posted to microsoft.public.excel.misc
|
|||
|
|||
![]()
Hi. Just a note. I may be wrong here though.
+WEEKDAY(A1,2)5) This took advantage of Excel returning an implied 1 or 0. Perhaps do this with the others. -(IF(AND(WEEKDAY(A1,2)<6,MOD(A1,1)17/24),1,0) So, subtract 1 if it's a weekday and after hours (5pm) AND(WEEKDAY(A1,2)<6,MOD(A1,1)17/24) and then later add 2 if it's the same thing.. +2*(IF(AND( WEEKDAY(A1,2)<6,MOD(A1,1)17/24) Could these be simplified? Dana DeLouis Savio wrote: is there any way to do this using VBA? =-(IF(AND(WEEKDAY(A1,2)<6,MOD(A1,1)17/24),1,0)+WEEKDAY(A1,2)6)+2*(IF (AND( WEEKDAY(A1,2)<6,MOD(A1,1)17/24),1,0)+WEEKDAY(A1,2)5)+A1 thanks |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
formula for Canadian postal codes | Excel Worksheet Functions | |||
Convert Column Formula into VBA codes | Excel Discussion (Misc queries) | |||
Tricky Formula Codes *** Urgent *** | Excel Discussion (Misc queries) | |||
Tricky Formula Codes ***Urgent*** | Excel Discussion (Misc queries) | |||
Formula to look up zip codes | Excel Discussion (Misc queries) |