+ Reply to Thread
Results 1 to 9 of 9

Cell with 2 formulas voids conditional formatting

  1. #1
    Registered User
    Join Date
    07-09-2018
    Location
    California
    MS-Off Ver
    Excel 2016
    Posts
    5

    Cell with 2 formulas voids conditional formatting

    Hello! I am using Excel 2016 and having an issue with conditional formatting.

    Cell E2 has 2 formulas at play:
    =IF(F2="",0,DAYS360(D2,F2))&IF(ISBLANK(F2),TODAY()-D2,"")

    This way I can calculate the number of days an invoice has been with my office using the date entered in D2 and the current date. When the date we sent the invoice to accounting is later entered into F2, E2 will then display the number of days the invoice was in our office using cells D2 and F2.

    The formulas work to display the correct number of days, but my conditional formatting will not work. I have formatted E2 to highlight in red if the cell value is over 15, but no matter what the value in E2, it is always red. How can I get conditional formatting to apply in E2?

    *Note* Conditional formatting works correctly in my cells that use only one of the below formulas at a time:
    =TODAY()-D3
    =IF(F4=””,0,DAYS360(D4,F4))
    Attached Files Attached Files

  2. #2
    Forum Moderator AliGW's Avatar
    Join Date
    08-10-2013
    Location
    Retired in Ipswich, Suffolk, but grew up in Sawley, Derbyshire (both in England)
    MS-Off Ver
    MS 365 Subscription Insider Beta Channel v. 2504 (Windows 11 Home 24H2 64-bit)
    Posts
    90,762

    Re: Cell with 2 formulas voids conditional formatting

    Because when you combine the two, the answer is no longer a number, but text, so use this:

    =VALUE(IF(F2="",0,DAYS360(D2,F2))&IF(ISBLANK(F2),TODAY()-D2,""))

    You can always set the formatting to show leading zeroes if you really need them.
    Last edited by AliGW; 07-10-2018 at 02:34 PM.
    Ali


    Enthusiastic self-taught user of MS Excel who's always learning!
    Don't forget to say "thank you" in your thread to anyone who has offered you help. It's a universal courtesy.
    You can reward them by clicking on * Add Reputation below their user name on the left, if you wish.

    NB:
    as a Moderator, I never accept friendship requests.
    Forum Rules (updated August 2023): please read them here.

  3. #3
    Forum Contributor Mvaldesi's Avatar
    Join Date
    01-21-2011
    Location
    Plano, TX
    MS-Off Ver
    MS365 (PC) v.2108
    Posts
    267

    Re: Cell with 2 formulas voids conditional formatting

    It's because the result of your concatenated formulas is a Text value, i.e.: the "07" in E2 is actua; "0" and "7" run together, and Excel doesn't see it as the number "7." What is it exactly you're trying to accomplish with the "&" and two formulas? Seems to me there's a simpler way (i.e.: a nested =IF() statement?) to achieve what I think you're going for.

  4. #4
    Forum Expert BadlySpelledBuoy's Avatar
    Join Date
    06-14-2013
    Location
    East Sussex, UK
    MS-Off Ver
    365
    Posts
    7,938

    Re: Cell with 2 formulas voids conditional formatting

    Another solution:
    Formula: copy to clipboard
    Please Login or Register  to view this content.


    BSB

  5. #5
    Forum Contributor Mvaldesi's Avatar
    Join Date
    01-21-2011
    Location
    Plano, TX
    MS-Off Ver
    MS365 (PC) v.2108
    Posts
    267

    Re: Cell with 2 formulas voids conditional formatting

    Does this work for you?

    =IF(ISBLANK(F2),DAYS360(D2,TODAY()),DAYS360(D2,F2))
    Attached Files Attached Files

  6. #6
    Registered User
    Join Date
    07-09-2018
    Location
    California
    MS-Off Ver
    Excel 2016
    Posts
    5

    Re: Cell with 2 formulas voids conditional formatting

    Oh perfect! This works. Would you be able to help format it further so that if D2 is empty, E2 will display "0." Currently if D2 is empty, E2 displays "043291"

  7. #7
    Forum Contributor Mvaldesi's Avatar
    Join Date
    01-21-2011
    Location
    Plano, TX
    MS-Off Ver
    MS365 (PC) v.2108
    Posts
    267

    Re: Cell with 2 formulas voids conditional formatting

    Maybe this?

    =IF(ISBLANK(D2),0,IF(ISBLANK(F2),DAYS360(D2,TODAY()),DAYS360(D2,F2)))

    EDIT: Take the zero in first logical test out of quotes.
    Attached Files Attached Files
    Last edited by Mvaldesi; 07-10-2018 at 02:55 PM.

  8. #8
    Forum Moderator AliGW's Avatar
    Join Date
    08-10-2013
    Location
    Retired in Ipswich, Suffolk, but grew up in Sawley, Derbyshire (both in England)
    MS-Off Ver
    MS 365 Subscription Insider Beta Channel v. 2504 (Windows 11 Home 24H2 64-bit)
    Posts
    90,762

    Re: Cell with 2 formulas voids conditional formatting

    Thanks for the rep!

    If that takes care of your original question, please select Thread Tools from the menu link above and mark this thread as SOLVED. Thanks.

  9. #9
    Forum Expert
    Join Date
    06-08-2012
    Location
    Left the forum!
    MS-Off Ver
    Left the forum!
    Posts
    5,189

    Re: Cell with 2 formulas voids conditional formatting

    Assuming column F will be either date or empty, something as simple as

    =IF(F2,F2,TODAY())-D2

    Formatted as number.

    All of these extra functions you are using are just making the task more complicated than it needs to be.

+ 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. Conditional Formatting and Formulas for a cell group based on birthdays
    By greenbje in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 03-14-2018, 09:41 PM
  2. [SOLVED] conditional formatting with formulas depending on current cell value and data
    By Mpmcderm in forum Excel - New Users/Basics
    Replies: 14
    Last Post: 11-20-2017, 03:43 PM
  3. Formulas based on if a cell is color filled with conditional formatting
    By adray13 in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 04-27-2016, 04:56 PM
  4. Using formulas/conditional formatting to change fill of cell based on two criteria
    By 121jessawatts in forum Excel Formulas & Functions
    Replies: 0
    Last Post: 05-09-2013, 09:42 PM
  5. Replies: 4
    Last Post: 01-31-2012, 04:36 AM
  6. microsoft query voids out spreadsheets
    By J Wanemacher in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 02-18-2005, 10:06 AM
  7. Conditional Formatting using result of Cell Formulas
    By Father Guido in forum Excel General
    Replies: 2
    Last Post: 01-26-2005, 01:06 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