+ Reply to Thread
Results 1 to 4 of 4

Days by month and IF statement.

  1. #1
    Daniel Q.
    Guest

    Days by month and IF statement.

    If A1 = 6/1/2006, can B1 = the number of days in June w/o using a VLOOKUP?

    Im trying to embed a couple of conditions in an IF statement and i don't
    know where to begin.

    I have a fixed volume of 500/day; July = 31 days; total 15500 for july.

    I need to charge .442 for the first 10000 per unit, 1.327 for the next 100
    units, 1.098 forthe next 140, and .9255 for the remaining units, which in
    this case are 5260.

    I made A1 = 500x31 (15500) and then have the formula point at it.

    How can i make C1 read A1 and then give me the correct output for that volume?

    Thank you for all your help in advance.

  2. #2
    Forum Contributor
    Join Date
    07-05-2006
    Location
    Canada
    MS-Off Ver
    2003, 2007
    Posts
    581
    Quote Originally Posted by Daniel Q.
    If A1 = 6/1/2006, can B1 = the number of days in June w/o using a VLOOKUP?

    Im trying to embed a couple of conditions in an IF statement and i don't
    know where to begin.

    I have a fixed volume of 500/day; July = 31 days; total 15500 for july.

    I need to charge .442 for the first 10000 per unit, 1.327 for the next 100
    units, 1.098 forthe next 140, and .9255 for the remaining units, which in
    this case are 5260.

    I made A1 = 500x31 (15500) and then have the formula point at it.

    How can i make C1 read A1 and then give me the correct output for that volume?

    Thank you for all your help in advance.
    Not sure if you meant B1 or C1, but try this:

    =DATE(YEAR(A1)+IF(MONTH(A1)=12,1,0),IF(MONTH(A1)=12,1,MONTH(A1)+1),1)-A1

    You'll have to switch the format to number, since it assumes you want it to be a date format.

    Scott

  3. #3
    Forum Contributor
    Join Date
    06-01-2006
    Posts
    324
    To find the number of days in a month, use this formula: =DAY(DATE(YEAR(A1),MONTH(A1)+1,0))

    Then just do that*500

    To be honest with you, the easiest way to calculate charge is this:

    =4706.42+(C1-10240)*.9255

    The reason why is because EVERY month, even if it only has 28 days, you will do over 10240 units, so you just want to find out what is the remainder and multiple it by .9255

    Ok. so put it all together in 1 formula:

    =4706.42+(DAY(DATE(YEAR(A1),MONTH(A1)+1,0))-10240)*.9255

    Not pretty, but it works
    Google is your best friend!

  4. #4
    bpeltzer
    Guest

    RE: Days by month and IF statement.

    If you have the analysis toolpak installed, you can use eomonth:
    =DAY(EOMONTH(A1,0)).
    If you don't have the ATP, =day(date(year(a1),month(a1)+1,0)) will get you
    the same result.

    "Daniel Q." wrote:

    > If A1 = 6/1/2006, can B1 = the number of days in June w/o using a VLOOKUP?
    >
    > Im trying to embed a couple of conditions in an IF statement and i don't
    > know where to begin.
    >
    > I have a fixed volume of 500/day; July = 31 days; total 15500 for july.
    >
    > I need to charge .442 for the first 10000 per unit, 1.327 for the next 100
    > units, 1.098 forthe next 140, and .9255 for the remaining units, which in
    > this case are 5260.
    >
    > I made A1 = 500x31 (15500) and then have the formula point at it.
    >
    > How can i make C1 read A1 and then give me the correct output for that volume?
    >
    > Thank you for all your help in advance.


+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1