Formula field - calculate invoice value

Formula field - calculate invoice value

Hi all

I want to use three fields, Arrival Date, Departure Date and Weekly Rate to calculate a field for Total Invoice.

If the difference between Departure and Arrival date (length of stay) divided into number of weeks leaves a remainder of more than 3 days, I want to round it up to the nearest week.

For example 3 weeks and 5 days I want to round up to 4 weeks, but if it is 3 weeks 2 days then to calculate the exact amount for 23 days. 

So basically I need a working If statement: 

Here's what I came up with:
If(Datecomp(${Accounts.Departure date},${Accounts.Arrival Date})/(60*24)/7)-Floor(Datecomp(${Accounts.Departure date},${Accounts.Arrival Date})/(60*24)/7)>=0.5, Ceil(Datecomp(${Accounts.Departure date},${Accounts.Arrival Date})/(60*24)/7), Ceil((Datecomp(${Accounts.Departure date},${Accounts.Arrival Date})/(60*24)/7))*${Accounts.Weekly Rate})

Disappointing, this returns an error wrong data type, maybe as I am trying to get this into a currency formula field.

Please help, this is causing me a massive headache! 

Steve