Navigacija
Lista poslednjih: 16, 32, 64, 128 poruka.

Business dani u vremenskom periodu po mesecima

[es] :: Office :: Excel :: Business dani u vremenskom periodu po mesecima

[ Pregleda: 925 | Odgovora: 6 ] > FB > Twit

Postavi temu Odgovori

Autor

Pretraga teme: Traži
Markiranje Štampanje RSS

nenandi
Nenad Andrejevic
System & ERP administrator
BAT
Vranje

Član broj: 76779
Poruke: 208
*.dynamic.isp.telekom.rs.

Sajt: https://www.linkedin.com/..


+3 Profil

icon Business dani u vremenskom periodu po mesecima22.12.2021. u 04:37 - pre 27 meseci
Kako da preracunam koliko dana pripada u mesecu ako ima datum pocetka i datum zavrsetka u koloni za svaki mesec,
trebam li da kreiram pomocne kolone za EOMONTH da ih mogao da izracunam samo business day?


Patience is a necessary ingredient for genius
Prikačeni fajlovi
 
Odgovor na temu

djux66
Beograd

Član broj: 66577
Poruke: 74
147.91.111.*

Sajt: www.mmveriga.co.rs


+9 Profil

icon Re: Business dani u vremenskom periodu po mesecima22.12.2021. u 09:57 - pre 27 meseci
Verovatno može i preko formula, ali bi bilo predugačko. Meni lakše napraviti custom vba function.
Ovde je naravno pretpostavka da startDate < endDate i da su oba datuma u istoj godini, u suprotom je 0.
Ne pokriva ni praznike...ali moglo bi da se reši.

Code:

Public Function GetWorkdays(ByVal startDate As Date, ByVal endDate As Date, monthNum As Integer) As Double
    On Error GoTo GetWorkdaysOnError
    
    Dim startMonth, endMonth As Integer
    Dim sof, eof As Date
    Dim wf As WorksheetFunction
    Set wf = Application.WorksheetFunction
    
    GetWorkdays = 0
    
    startMonth = month(startDate)
    endMonth = month(endDate)
    
    If ((startMonth > monthNum And endMonth < monthNum) Or (Year(startDate) <> Year(endDate)) Or (startDate > endDate)) Then
        Exit Function
    ElseIf (startMonth < monthNum And endMonth > monthNum) Then
        sof = DateSerial(Year(startDate), monthNum, 1)
        eof = wf.EoMonth(sof, 0)
    ElseIf (startMonth = monthNum And endMonth = monthNum) Then
        sof = startDate
        eof = endDate
    ElseIf (startMonth = monthNum) Then
        sof = startDate
        eof = wf.EoMonth(sof, 0)
    ElseIf (endMonth = monthNum) Then
        sof = DateSerial(Year(endDate), monthNum, 1)
        eof = endDate
    End If
    
    GetWorkdays = wf.NetworkDays(sof, eof)

GetWorkdaysOnError:
    Set wf = Nothing

End Function

Prikačeni fajlovi
 
Odgovor na temu

nenandi
Nenad Andrejevic
System & ERP administrator
BAT
Vranje

Član broj: 76779
Poruke: 208
165.225.73.*

Sajt: https://www.linkedin.com/..


+3 Profil

icon Re: Business dani u vremenskom periodu po mesecima22.12.2021. u 14:23 - pre 27 meseci
Hvala djukx66,

Reseno je preko excela tabela je na SP
Morao sam da kreiram pomocne kolone da odredim pocetak i kraj meseca, a onda preko uslova da ako je isti mesec da smo oduzme,
a funkcijom NETWORKDAYS sam dobio tacno radne dani i ima mogucnost da ubacis i drzavne praznike da ih ne preracunava.
Patience is a necessary ingredient for genius
 
Odgovor na temu

Ivek33

Član broj: 66174
Poruke: 2898



+66 Profil

icon Re: Business dani u vremenskom periodu po mesecima22.12.2021. u 14:52 - pre 27 meseci
Citat:
nenandi: Morao sam da kreiram pomocne kolone ....

Riješio si ok, s obzirom da sam i ja radio sa pomoćnim stupcima, zanima me tvoje rješenje.
No ja nisam postao jer je formula predugačka @kao što je @djux66 spomenuo.

Možeš li prikačiti tvoje rješenje?
 
Odgovor na temu

nenandi
Nenad Andrejevic
System & ERP administrator
BAT
Vranje

Član broj: 76779
Poruke: 208
165.225.73.*

Sajt: https://www.linkedin.com/..


+3 Profil

icon Re: Business dani u vremenskom periodu po mesecima23.12.2021. u 07:30 - pre 27 meseci
evo sheet u prilogu koji razdvaja dane po mesecu, imam jos jedan sheet koji radi sumif po mesecima
Patience is a necessary ingredient for genius
Prikačeni fajlovi
 
Odgovor na temu

Ivek33

Član broj: 66174
Poruke: 2898



+66 Profil

icon Re: Business dani u vremenskom periodu po mesecima23.12.2021. u 07:58 - pre 27 meseci
Ja sam tebe sasvim drugačije shvatio.
Vidi prilog
Prikačeni fajlovi
 
Odgovor na temu

nenandi
Nenad Andrejevic
System & ERP administrator
BAT
Vranje

Član broj: 76779
Poruke: 208
165.225.73.*

Sajt: https://www.linkedin.com/..


+3 Profil

icon Re: Business dani u vremenskom periodu po mesecima23.12.2021. u 13:06 - pre 27 meseci
Ivek extra dosta uproscenije,
moze i tako slucaj kod mene je drugaciji zato sto je tabela i mesece sam morao drugacije da uporedjujem.
Patience is a necessary ingredient for genius
 
Odgovor na temu

[es] :: Office :: Excel :: Business dani u vremenskom periodu po mesecima

[ Pregleda: 925 | Odgovora: 6 ] > FB > Twit

Postavi temu Odgovori

Navigacija
Lista poslednjih: 16, 32, 64, 128 poruka.