I'm trying to create a formula that will give me the distance in days between 2 different days of the week with min/max of +7/-7. So for instance is there a formula to find that the days between this Monday and the coming Thursday is 3 but the distance between this Tuesday and the next Sunday is 5. Also in reverse, the distance between this Wednesday and the previous Monday should return -2, and the distance between this Friday and the previous Saturday is -6. This formula should work for calculating the distance between days for all combinations. Is there such a formula or will I just need to put a series of if/else statements in my code?
Thanks for any help!
How about this:
Some typical user sessions from the prompt:
calcdis('th','m')
calcdis('su','su')
Note: there's no error checking, but I think it does what you want - the specifications are not entirely clear, especially regarding the form of the input.