Jump to content

Excel formula separator


Recommended Posts

They are formatted as Date. I will try to use this functions instead in conjunction with the locale settings as a workaround:

$sStartDate = "2018/05/16"
$sEndDate = "2018/05/21"

$iBussinessDays = _BussinessDays($sStartDate, $sEndDate)
ConsoleWrite("There are " & $iBussinessDays & " bussiness days between " & $sStartDate & " and " & $sEndDate & @CRLF)

Func _BussinessDays($sStartDate, $sEndDate)
    $iCounter = 0
    $iDifferenceInDays = _DateDiff('D', $sStartDate, $sEndDate)
    For $i = 0 To $iDifferenceInDays
        $sNextDate = _DateAdd('D', $i, $sStartDate)
        $aSplitDate = StringSplit($sNextDate, "/")
        $sDayOfWeek = _DateToDayOfWeekISO($aSplitDate[1], $aSplitDate[2], $aSplitDate[3])
        If $sDayOfWeek >= 1 And $sDayOfWeek <= 5 Then
            $iCounter += 1
        EndIf
    Next
    Return $iCounter
EndFunc   ;==>_BussinessDays

 

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...