+ Reply to Thread
Results 1 to 5 of 5

Stop a formula if a cell has a certain text

  1. #1
    Registered User
    Join Date
    01-20-2021
    Location
    Pakistan
    MS-Off Ver
    206 Professional Plus
    Posts
    4

    Stop a formula if a cell has a certain text

    Hello experts,
    I ran into a problem with my excel sheet.
    in the sheet Column "B" has an order date and Column "H" is counting days till today.
    I want Column "H" to stop counting the day if Column"F" has a date.
    Column "H" show day count till the date of column F
    please see attached sample file.

    Looking forward to your help
    Attached Files Attached Files

  2. #2
    Registered User
    Join Date
    08-07-2009
    Location
    Honolulu, HI
    MS-Off Ver
    Excel 2003
    Posts
    16

    Re: Stop a formula if a cell has a certain text

    Try this formula in H2

    Please Login or Register  to view this content.
    Basically it works like this
    In words it basically means
    If F2 is nothing, do nothing, otherwise do this formula.

    Copy and paste down as needed.

    Does this help?

  3. #3
    Administrator FDibbins's Avatar
    Join Date
    12-29-2011
    Location
    Duncansville, PA USA
    MS-Off Ver
    Excel 7/10/13/16/365 (PC ver 2310)
    Posts
    52,929

    Re: Stop a formula if a cell has a certain text

    1. TODAY is volatile and if used a lot, could slow your file down. Rather, put TODAY() once in a cell somewhere (say, K1), then just reference it in your formula....=$K$1-$B2

    2. If you need to not show anything if F contains a date...
    =if(F2="",your-formula,"")
    (I think Dark has it the wrong way round)
    1. Use code tags for VBA. [code] Your Code [/code] (or use the # button)
    2. If your question is resolved, mark it SOLVED using the thread tools
    3. Click on the star if you think someone helped you

    Regards
    Ford

  4. #4
    Registered User
    Join Date
    01-20-2021
    Location
    Pakistan
    MS-Off Ver
    206 Professional Plus
    Posts
    4

    Re: Stop a formula if a cell has a certain text

    Quote Originally Posted by FDibbins View Post
    1. TODAY is volatile and if used a lot, could slow your file down. Rather, put TODAY() once in a cell somewhere (say, K1), then just reference it in your formula....=$K$1-$B2

    2. If you need to not show anything if F contains a date...
    =if(F2="",your-formula,"")
    (I think Dark has it the wrong way round)
    Nopes both are not working if I use your formula it start showing -4326 something days.
    and darks formula is not working

    I actually want H o count days until F has a date. Whne F has a date H should stop counting further and show the different between B and F

  5. #5
    Registered User
    Join Date
    08-07-2009
    Location
    Honolulu, HI
    MS-Off Ver
    Excel 2003
    Posts
    16

    Re: Stop a formula if a cell has a certain text

    While you could just take the answer from the end of the post, I do hope that you take a moment understand the fundamentals of the if command because it is the most powerful command in my opinion one of the very core commands you should understand. Using this command you can accomplish almost anything in terms of excel (within reason of course)

    So to help you understand how to make this work for you, you need to write out the goals you wish to achieve.

    Write your request out in terms of IF statements then build the IF command using those statements.

    So let's see if I get this right.

    Based on your post.

    This is what it sounds like you want.

    1. If F HAS NO DATE then H to count days until F has a date
    2. IF F has a date, show difference between b and F


    Remember the pattern. =IF(THIS<=>THAT,DOIFTRUE,DOIFFALSE)
    Does that sum it up?
    So let's write the first IF statement
    Please Login or Register  to view this content.
    That means If F2 equals nothing, Subtract B2 from today's date otherwise do nothing. This fulfills your first requirement.

    So what about your second requirement?
    If F has a date, show the difference between B and F. Let's write that formula out.
    Please Login or Register  to view this content.
    That means IF F2 is anything other than nothing then F2-B2 otherwise do nothing.

    Now we put them together and combine the sentences together.
    If F2 EQUALS nothing then TODAYS DATE-F2 OTHERWISE DO IF F2 is ANYTHING OTHER THAN nothing then F2-B2 OTHERWISE DO nothing.

    So replace the words in that sentence with the appropriate commands and you should have your formula. It would look like this.
    Please Login or Register  to view this content.
    You could also rephrase the sentence like this.
    If F2 EQUALS nothing then TODAYS DATE-F2 OTHERWISE DO F2-B2.
    You can write that out like this.
    Please Login or Register  to view this content.
    Easiest way to write complex nested statements is to write out the requirements into sentences and fill in the blanks (at least for me anyway)
    I hope this help.

    Does that solve your problem?
    Last edited by Darkflame808; 01-29-2021 at 01:21 AM.

+ 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. How to stop formula/calculations based on a text entry
    By jamesproudlock1993 in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 12-17-2018, 10:25 AM
  2. Lookup with a stop if cell value equals a specific text?
    By MnJeeper in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 08-23-2017, 12:12 PM
  3. Macro delay and stop if wrong text in cell
    By Robbosan in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 06-16-2016, 06:10 AM
  4. [SOLVED] How to get a text in a cell and excel knows where to stop getting the text
    By Lan Tran in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 07-16-2015, 07:08 AM
  5. Stop text from overlapping cell
    By Jordans121 in forum Excel Formulas & Functions
    Replies: 0
    Last Post: 11-11-2010, 12:06 AM
  6. Replies: 0
    Last Post: 08-15-2006, 10:20 AM
  7. Replies: 3
    Last Post: 09-21-2005, 11:05 PM

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