+ Reply to Thread
Results 1 to 4 of 4

Stop a formula if a cell has certain text but retain figure

  1. #1
    Registered User
    Join Date
    11-10-2020
    Location
    Worthing
    MS-Off Ver
    2016
    Posts
    8

    Stop a formula if a cell has certain text but retain figure

    Hello All, I have a question which I will try and keep as simple as possible.

    I have certain cells counting up from a date which i would like to stop counting when certain criteria are met.

    Example:

    If cell F2 has no date then T2 is to count the number of days from the date in D2.
    If F2 has a date then T2 is to stop counting the date in D2 but retain the value, same thing should happen when a date is entered into K2.
    If a date is in F2 then U2 is to start counting from that date and stop once a date has been entered into K2, U2 is to retain value.

    Hope this makes sense, also D2 will always have a date.

    Thank you in advance for any help.

    Nick

  2. #2
    Administrator 6StringJazzer's Avatar
    Join Date
    01-27-2010
    Location
    Tysons Corner, VA, USA
    MS-Off Ver
    MS365 Family 64-bit
    Posts
    24,696

    Re: Stop a formula if a cell has certain text but retain figure

    What do you have in T2 and U2 right now?

    In almost all cases, freezing a value that is returned by a formula once some event occurs requires VBA. For us to give you a working solution, please provide your file. See yellow banner at the top of the page.
    Jeff
    | | |會 |會 |會 |會 | |:| | |會 |會
    Read the rules
    Use code tags to [code]enclose your code![/code]

  3. #3
    Registered User
    Join Date
    11-10-2020
    Location
    Worthing
    MS-Off Ver
    2016
    Posts
    8

    Re: Stop a formula if a cell has certain text but retain figure

    I have attached an example
    Attached Files Attached Files

  4. #4
    Administrator 6StringJazzer's Avatar
    Join Date
    01-27-2010
    Location
    Tysons Corner, VA, USA
    MS-Off Ver
    MS365 Family 64-bit
    Posts
    24,696

    Re: Stop a formula if a cell has certain text but retain figure

    I focused on your description using "counting", where it seems like all you are really doing is showing elapsed days between dates.

    If a date is placed into F2, wouldn't T2 be the elapsed time from D2 to F2?

    Similarly, if a date is placed in K2, wouldn't U2 be the elapsed time from F2 to K2?

    If so then these formulas would apply, without having to use VBA:

    T2: =IF(D2="","",IF(F2="",TODAY(),F2)-D2)

    U2: =IF(F2="","",IF(K2="",TODAY(),K2)-F2)

+ 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. Stop a formula if a cell has a certain text
    By Alishk in forum Excel General
    Replies: 4
    Last Post: 01-29-2021, 01:12 AM
  2. Retain time format whilst formatting cell to text?
    By y_not in forum Excel General
    Replies: 2
    Last Post: 11-03-2016, 11:17 PM
  3. Replace text string in a cell and retain rich text formatting (Excel 2013)
    By CharlieBear in forum Excel Programming / VBA / Macros
    Replies: 15
    Last Post: 04-15-2015, 04:39 PM
  4. Replies: 2
    Last Post: 03-24-2015, 03:47 PM
  5. Replies: 1
    Last Post: 05-22-2013, 05:47 PM
  6. [SOLVED] Cannot get a cell to retain formatting when a part of a text string
    By Grimace in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 12-17-2012, 12:08 AM
  7. Replies: 8
    Last Post: 06-20-2008, 08:01 AM

Tags for this Thread

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