+ Reply to Thread
Results 1 to 9 of 9

Issues modifying formula

  1. #1
    Forum Contributor
    Join Date
    05-13-2012
    Location
    Atlanta, GA
    MS-Off Ver
    Excel 2010
    Posts
    378

    Question Issues modifying formula

    Hello everyone,

    So, I have some VBA code that I am trying to use and I can't seem to get the criteria situated correctly for it to work correctly. Let me explain what I am trying to do first...I have 4 columns with dates...for the sake of argument lets say they are in columns A, B, C, and D, but not every cell in columns C or D have data points. So, what I want this code to do is that if the cell is column D is empty then use one specific formula but if it is not empty then is use a different formula. So for example, if D5 had a date in it then the formula in E5 would be
    Formula: copy to clipboard
    Please Login or Register  to view this content.
    and then go to the next cell down in column E until no more rows of data. Then if on row 7 and D7 was empty then the formula in E7 would be
    Formula: copy to clipboard
    Please Login or Register  to view this content.


    Here is the code I have been trying to modify but just can't figure it out...
    Please Login or Register  to view this content.
    Any ideas or solutions?

    Thanks!!!!

  2. #2
    Forum Guru xladept's Avatar
    Join Date
    04-14-2012
    Location
    Pasadena, California
    MS-Off Ver
    Excel 2003,2010
    Posts
    12,378

    Re: Issues modifying formula

    This seems to work:

    Please Login or Register  to view this content.
    If I've helped you, please consider adding to my reputation - just click on the liitle star at the left.

    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~(Pride has no aftertaste.)

    You can't do one thing. XLAdept

    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~aka Orrin

  3. #3
    Forum Contributor
    Join Date
    05-13-2012
    Location
    Atlanta, GA
    MS-Off Ver
    Excel 2010
    Posts
    378

    Re: Issues modifying formula

    This still is not referencing the correct cell to determine which formula to use. It seems to still check whether the cell where the formula is going is empty or not.

  4. #4
    Forum Guru xladept's Avatar
    Join Date
    04-14-2012
    Location
    Pasadena, California
    MS-Off Ver
    Excel 2003,2010
    Posts
    12,378

    Re: Issues modifying formula

    Sorry:

    Please Login or Register  to view this content.
    Last edited by xladept; 09-18-2017 at 02:25 PM. Reason: Very sorry after seeing shg's post

  5. #5
    Forum Expert shg's Avatar
    Join Date
    06-20-2007
    Location
    The Great State of Texas
    MS-Off Ver
    2003, 2010
    Posts
    40,678

    Re: Issues modifying formula

    Another way:

    Please Login or Register  to view this content.
    For example,

    A
    B
    C
    D
    E
    F
    1
    Date1
    Date2
    Date3
    Date4
    2
    E2: Blank
    3
    24 Dec 2017
    E3: Blank
    4
    4 Mar 2017
    E4: Blank
    5
    26 Jun 2017
    16 Aug 2017
    38
    E5: =NETWORKDAYS(C5, D5)
    6
    25 Sep 2017
    E6: Blank
    7
    8 Nov 2017
    28 Jul 2017
    E7: Blank
    8
    27 Oct 2017
    25 Mar 2017
    25 Jul 2017
    87
    E8: =NETWORKDAYS(C8, D8)
    9
    2 Oct 2017
    13 May 2017
    19 Jul 2017
    48
    E9: =NETWORKDAYS(C9, D9)
    10
    10 Jan 2017
    E10: Blank
    11
    2 Jan 2017
    6 Nov 2017
    E11: Blank
    12
    3 May 2017
    10 Jun 2017
    E12: Blank
    13
    6 May 2017
    7 Apr 2017
    6 Aug 2017
    86
    E13: =NETWORKDAYS(C13, D13)
    14
    4 May 2017
    18 Oct 2017
    120
    E14: =NETWORKDAYS(A14, B14)
    15
    25 Jan 2017
    13 Dec 2017
    10 Nov 2017
    231
    E15: =NETWORKDAYS(A15, B15)
    16
    5 Feb 2017
    2 Aug 2017
    20 Jan 2017
    128
    E16: =NETWORKDAYS(A16, B16)
    17
    29 May 2017
    10 Sep 2017
    9 Jun 2017
    20 Oct 2017
    171
    E17: =NETWORKDAYS(A17, B17) + NETWORKDAYS(C17, D17)
    Entia non sunt multiplicanda sine necessitate

  6. #6
    Forum Contributor
    Join Date
    05-13-2012
    Location
    Atlanta, GA
    MS-Off Ver
    Excel 2010
    Posts
    378

    Re: Issues modifying formula

    Ok...I have included a sample of the data that I am working with for reference. In Column "T" is where I want the formula to be entered. Again...I want the code to look in Column "Q" and if this cell is empty then in Column "T", the formula entered should be
    Formula: copy to clipboard
    Please Login or Register  to view this content.
    . If that cell is not empty then the formula should be
    Formula: copy to clipboard
    Please Login or Register  to view this content.
    . Then this repeats for each cell in Column "T" that has data.
    Attached Files Attached Files

  7. #7
    Forum Guru xladept's Avatar
    Join Date
    04-14-2012
    Location
    Pasadena, California
    MS-Off Ver
    Excel 2003,2010
    Posts
    12,378

    Re: Issues modifying formula

    Try this:

    Please Login or Register  to view this content.

  8. #8
    Forum Contributor
    Join Date
    05-13-2012
    Location
    Atlanta, GA
    MS-Off Ver
    Excel 2010
    Posts
    378

    Re: Issues modifying formula

    That worked beautifully...thanks!!!

  9. #9
    Forum Guru xladept's Avatar
    Join Date
    04-14-2012
    Location
    Pasadena, California
    MS-Off Ver
    Excel 2003,2010
    Posts
    12,378

    Re: Issues modifying formula

    You're welcome and thanks for the rep!

+ 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. Issues in modifying date format
    By babarorhum in forum Excel General
    Replies: 6
    Last Post: 06-24-2009, 09:35 AM
  2. modifying formula
    By Crasher in forum Excel Formulas & Functions
    Replies: 8
    Last Post: 10-12-2006, 12:53 PM
  3. Help Modifying this Formula ....
    By Mhz in forum Excel - New Users/Basics
    Replies: 9
    Last Post: 07-30-2006, 06:40 AM
  4. [SOLVED] Modifying A Formula
    By Mangesh Yadav in forum Excel Formulas & Functions
    Replies: 24
    Last Post: 09-06-2005, 07:05 AM
  5. Modifying A Formula
    By Mangesh Yadav in forum Excel Formulas & Functions
    Replies: 24
    Last Post: 09-06-2005, 06:05 AM
  6. [SOLVED] Modifying A Formula
    By Mangesh Yadav in forum Excel Formulas & Functions
    Replies: 36
    Last Post: 09-06-2005, 04:05 AM
  7. Modifying A Formula
    By carl in forum Excel Formulas & Functions
    Replies: 0
    Last Post: 09-05-2005, 11:05 PM
  8. Modifying A Formula
    By carl in forum Excel Formulas & Functions
    Replies: 0
    Last Post: 09-05-2005, 10:05 PM

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