Exercising and gaining weight.

Options
I have been working out for the past 2 weeks and 3 days and have lost 8.4 lbs. I have noticed a trend that when I really workout a lot the next day I either only lose a little weight, stay the same or gain weight. I have been sick and have shin splints the last few days so had not been working out. Then I went walking last night after dinner for a while and only lost .2 lbs. I don't quite get what is going on. I want to lose around 40 lbs. I am very happy with the weight I have lost so far but just wondering why I lose more when I am not working out.