+ Reply to Thread
Results 1 to 4 of 4

Time Left and If/Then

  1. #1
    Registered User
    Join Date
    01-19-2008
    Posts
    1

    Time Left and If/Then

    I have 2 questions.

    A B C
    1 100 x 100 (If B1 = x, then C1 = 100)
    2 100 0 (If B1 = nothing, then C2 = 0)
    3

    I want an if/then function to check for an "x", if there is an "x" it will return the value.

    If it does not have an "x" it returns 0.

    Second Question

    Let's say that a certain item costs $5. I want to multiply that by the remaining days in the month.

    So let's say theres 5 days remaining till month end. Than it would be $25.

    I'm so sorry if these are confusing... let me know if you need clarification.

  2. #2
    Forum Expert
    Join Date
    01-15-2007
    Location
    Brisbane, Australia
    MS-Off Ver
    2007
    Posts
    6,591
    Hi

    1) =if(b1="x",a1,"")

    2) =(DAY(EOMONTH(NOW(),0))-DAY(NOW()))*5

    If you don't have the EOMONTH function, then go tools, addins, and select the analysis toolpak and analysis toolpak - vba options.


    rylo

  3. #3
    Forum Expert
    Join Date
    01-03-2006
    Location
    Waikato, New Zealand
    MS-Off Ver
    2010 @ work & 2007 @ home
    Posts
    2,243
    hi,

    Answer 1)
    =IF(B1="x",A1,0)

    Answer 2)
    Cell A2 =TODAY()
    Cell B2 =DAY(DATE(YEAR($A$2),MONTH($A$2)+1,0))-DAY($A$2)
    Cell A4 = $5
    Cell B4 = A4*$B$2

    You can copy cell B4 down for as many rows as there are items. By putting the "Days left" formula in a separate cell it means that Excel only has to perform the calculation once even when you copy the B4 formula down the page for tens or thousands of items.

    The "days left formula" was copied from Chip's below page:
    http://www.cpearson.com/Excel/DateTi...tm#DaysInMonth

    He also has a lot of useful date & time links at the base of the below page:
    http://www.cpearson.com/Excel/datetime.htm


    hth
    Rob
    Rob Brockett
    Kiwi in the UK
    Always learning & the best way to learn is to experience...

  4. #4
    Forum Expert
    Join Date
    01-03-2006
    Location
    Waikato, New Zealand
    MS-Off Ver
    2010 @ work & 2007 @ home
    Posts
    2,243
    nice one Rylo,
    I thought there was a tidier function but couldn't remember what it was.

    Rob

+ 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