+ Reply to Thread
Results 1 to 5 of 5

Formula not working when criteria cell is populated with a formula

  1. #1
    Forum Contributor
    Join Date
    04-04-2016
    Location
    dallas tx
    MS-Off Ver
    365 (15.0.5501.1000)
    Posts
    534

    Formula not working when criteria cell is populated with a formula

    I have a simple logic statement that checks the time and if it is less than a set time it is to display a 1. If the time is greater then display a 2. It works great when I type the times out but when I populate the question cell with Now() formula it no longer works.
    How do you get the logic test to look at the value of the cell and not return a "negative" when it sees a formula?
    Attached Files Attached Files
    Last edited by chriswrcg; 05-06-2023 at 10:17 AM.

  2. #2
    Forum Expert etaf's Avatar
    Join Date
    10-22-2004
    Location
    Wittering, West Sussex, UK
    MS-Off Ver
    365 (Mac OSX) (16.84 (24041420))
    Posts
    8,787

    Re: Formula not working when criteria cell is populated with a formula

    is that because the date is included in now()

    Need to see the formula you are using - otherwise guessing
    plus

    A sample sheet would help here, and possibly get quicker more accurate solution

    The forum does allow for spreadsheets to be uploaded direct to the forum -

    Please see the Yellow Banner at the top of the page explaining how to attach a sample spreadsheet

    A good sample workbook has just 10-20 rows of representative data that has been desensitised. It also has expected results mocked up, relevant cells highlighted and a few explanatory notes.

    Here are the instructions, found at the top of the page again
    Post a small Excel sheet (not a picture) showing realistic & representative sample data WITHOUT confidential information (10-20 rows, not thousands...) and some manually calculated results. For a new thread (1st post), scroll to Manage Attachments, otherwise scroll down to GO ADVANCED, click, and then scroll down to MANAGE ATTACHMENTS and click again. Now follow the instructions at the top of that screen.
    Wayne
    if my assistance has helped, and only if you wish to , there is an "* Add Reputation" on the left hand side - you can add to my reputation here

    If you have a solution to your thread - Please mark your thread solved do the following: >
    Select Thread Tools-> Mark thread as Solved. To undo, select Thread Tools-> Mark thread as Unsolved.

  3. #3
    Forum Expert
    Join Date
    05-05-2015
    Location
    UK
    MS-Off Ver
    Microsoft Excel for Microsoft 365 MSO (Version 2402 Build 16.0.17328.20068) 64-bit
    Posts
    28,353

    Re: Formula not working when criteria cell is populated with a formula

    Try

    =IF(D2="Saturday",3,IF(D2="Sunday",3,IF(D2="Monday",3,IF(MOD(E2,1)<E3,1,2))))

    You are comparing Date+Time [NOW()] rather than Time
    If that takes care of your original question, please select Thread Tools from the menu link above and mark this thread as SOLVED.

  4. #4
    Forum Expert
    Join Date
    01-05-2013
    Location
    Singapore
    MS-Off Ver
    H&B2016 & H&B2021
    Posts
    3,069

    Re: Formula not working when criteria cell is populated with a formula

    Change E2 to =MOD(NOW(),1) to cut off the date.

  5. #5
    Forum Guru Pete_UK's Avatar
    Join Date
    12-31-2011
    Location
    Warrington, England
    MS-Off Ver
    Office 2019 (still learning)
    Posts
    24,811

    Re: Formula not working when criteria cell is populated with a formula

    You can change your formula to this:

    =IF(LEFT(D2)="S",3,IF(D2="Monday",3,IF(MOD(E2,1)<MOD(E3,1),1,2)))

    Note that the NOW() function returns the date as well as the time, as Wayne stated, so the MOD function strips out the date part. Strictly speaking, the second MOD function is not necessary, but it is probably safer to leave it in.

    Hope this helps.

    Pete

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. [SOLVED] List populated by criteria not working
    By chriswrcg in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 06-08-2022, 12:10 PM
  2. [SOLVED] if formula not working when cells populated with formulas
    By chriswrcg in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 04-14-2022, 08:36 AM
  3. [SOLVED] Formula not working correctly when a cell is being populated by another formula
    By gazzak in forum Excel Formulas & Functions
    Replies: 7
    Last Post: 07-23-2021, 11:10 AM
  4. Formula to get value of last populated cell and +1 to that value?
    By WesD in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 11-12-2019, 05:16 PM
  5. Replies: 3
    Last Post: 03-09-2019, 12:04 PM
  6. Formula not working with multiple cell criteria
    By pentekno2 in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 05-26-2014, 12:32 PM
  7. Formula to search and return cell based on criteria not working
    By DifferentFrogs in forum Excel General
    Replies: 9
    Last Post: 03-21-2012, 10:48 AM

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