ShowAll Questionssorted byDate Posted
Mani Penumarthi

# salary depends on day

hi guys,

i need to calculate the salary for every month. for that purpose i can use standard functions. but

for a month there will be 31 days also and 4 sundays and 4 saturdays. how to calculate these things in salesforce?

and if there are any holidays it wont include the hours in total calucalted hours

im confused for to do this..

Navatar_DbSup

Hi,

Try the below formula for reference. It will give you the total number of days excluding Saturday and Sunday. Now use this for calculation of Salary.

CASE(

MOD(DATEVALUE(CreatedDate) - DATE(1900, 1, 7), 7),

0, (TODAY() - DATEVALUE(CreatedDate)) - 1 - FLOOR((TODAY() - DATEVALUE(CreatedDate))/7)*2,

1, (TODAY() - DATEVALUE(CreatedDate)) - FLOOR((TODAY() - DATEVALUE(CreatedDate))/7)*2,

2, (TODAY() - DATEVALUE(CreatedDate)) - FLOOR((TODAY() - DATEVALUE(CreatedDate))/7)*2,

3, (TODAY() - DATEVALUE(CreatedDate)) - FLOOR((TODAY() - DATEVALUE(CreatedDate))/7)*2,

4, (TODAY() - DATEVALUE(CreatedDate)) - FLOOR((TODAY() - DATEVALUE(CreatedDate))/7)*2,

5, (TODAY() - DATEVALUE(CreatedDate)) - 2 - FLOOR((TODAY() - DATEVALUE(CreatedDate))/7)*2,

6, (TODAY() - DATEVALUE(CreatedDate)) - 2 - FLOOR((TODAY() - DATEVALUE(CreatedDate))/7)*2,

null)

Did this answer your question? If not, let me know what didn't work, or if so, please mark it solved.