PDA

View Full Version : Excel experts of the world, unite!


abbor
09-08-2005, 07:58 PM
Okay, here's the situation...

At my work, we have this salary arrangement..

All days from Monday to Friday, I have 103,98 NOK before 18:00.
Between 18:00 and 21:00 I get 124,98 NOK.
Between 21:00 and 23:15 I get 144,99 NOK.

So I put together this Excel-doc to find out what I'm gonna earn:

http://home.no.net/redheadn/JW/Bok2.xls

The problem is that I'm not a very good programmer, this is the first time I ever used the IF-function in Excel.

I want to type in C and D when I have worked from and to, and then let Excel fill in the correct times under the different wages.

It works every time I fill in a time where I've worked within all the wages, but as soon there's one exception(See line 5), everything fucks up because of my code..

Can anyone please tell me what functions I should use instead of those I've used?

SFDMALEX
09-08-2005, 08:54 PM
Computers suck. Grab a pencil a peice of paper and a calculator. :wink:

abbor
09-09-2005, 02:28 PM
Please... Not anyone..?

I stayed up till 5 AM this night working on it, but I couldn't get it to work...

Here's my latest version:

http://home.no.net/redheadn/JW/Bok3.xls

AlienDB7
09-09-2005, 06:25 PM
Here's a possible solution for you:

Set up 3 columns, one for each salary range... they will be used to store # of hours.

Let's say 3 the columns are E, F and G.

In column E, put down the formula (without quotes): "=MAX(0,MIN(D3,(1800/2400))-C3)"

In column F, put down the formula: "=MAX(0,MIN(D3,(2100/2400))-MAX(C3, (1800/2400)))"

In column G, put down the formula: "=MAX(0,MIN(D3,(2325/2400))-MAX(C3, (2100/2400)))"

You just have to multiple them with the corresponding rate to get the total salary for the day. Hope this works... if not, dont chase after me for your missing salary :mrgreen:

abbor
09-09-2005, 06:47 PM
I made it... :D But I used a lot more advanced way than you alien... I used something like a trillion IFs, so I'm very, very confused right now, but I think I made it...

pharzo
09-09-2005, 07:23 PM
I used something like a trillion IFs

In computer science, if that's the case, there's surely an easier way :wink:

Overmind
09-09-2005, 08:53 PM
I used something like a trillion IFs

In computer science, if that's the case, there's surely an easier way :wink:

lol you mean the switch - case construct ? :lol: :D

pharzo
09-09-2005, 11:51 PM
that's just another way of writing if statements

what you want is a loop, or a recursive solution :P

abbor
09-10-2005, 03:25 PM
Well, to write a trillion ifs, I'd use more than a lifetime so that's not a problem... ;)

Overmind
09-10-2005, 05:15 PM
Well, to write a trillion ifs, I'd use more than a lifetime so that's not a problem... ;)

*hint* well you can have them generated :), just write a loop :).