+ Reply to Thread
Results 1 to 3 of 3

How to Get number of Day’s interval by Looping Through spreadsheet

  1. #1
    Registered User
    Join Date
    06-27-2015
    Location
    USA
    MS-Off Ver
    2010
    Posts
    47

    How to Get number of Day’s interval by Looping Through spreadsheet

    I have an excel spreadsheet containing 140K rows. The requirement is to find “number of Call days between calls on the same Client for the same product”. I have created the Key( Column E) by concatenate Column B and C. The expected output result is put into Column F. For example value 8 under column F was derived by =NETWORKDAYS(D4,D5) which is 4/6/2015,4/15/2015.

    I am looking for a VBA code to go through the entire ~140K file and write the # of Days Interval into Column F.


    Rep(Column A) Client Name(Column B) Product(Column C) Call Date(Column D) Key(Client+Product) Column E # of Day's Interval (F) - Expected Output Value
    Rep 1 Client 1 Product 1 5/20/2015 Client 1-Product 1 0
    Rep 2 Client 2 Product 2 3/31/2015 Client 2-Product 2 0
    Rep 3 Client 3 Product 1 4/6/2015 Client 3-Product 1 0
    Rep 3 Client 3 Product 1 4/15/2015 Client 3-Product 1 8
    Rep 4 Client 3 Product 1 4/15/2015 Client 3-Product 1 0
    Rep 3 Client 3 Product 1 4/22/2015 Client 3-Product 1 6
    Rep 4 Client 3 Product 1 4/30/2015 Client 3-Product 1 7
    Rep 3 Client 3 Product 1 5/13/2015 Client 3-Product 1 10
    Rep 4 Client 3 Product 1 5/13/2015 Client 3-Product 1 0
    Rep 3 Client 3 Product 1 6/3/2015 Client 3-Product 1 16
    Rep 4 Client 3 Product 1 6/11/2015 Client 3-Product 1 7
    Rep 3 Client 3 Product 1 6/19/2015 Client 3-Product 1 7
    Rep 5 Client 4 Product 1 6/3/2015 Client 4-Product 1 0
    Rep 5 Client 4 Product 1 6/19/2015 Client 4-Product 1 13
    Rep 5 Client 4 Product 2 4/13/2015 Client 4-Product 2 0
    Rep 5 Client 4 Product 2 5/29/2015 Client 4-Product 2 35
    Rep 5 Client 4 Product 3 4/24/2015 Client 4-Product 3 0
    Rep 5 Client 4 Product 4 6/15/2015 Client 4-Product 4 0
    Rep 6 Client 5 Product 5 5/18/2015 Client 5-Product 5 0
    Last edited by excelmr; 06-27-2015 at 07:15 PM.

  2. #2
    Forum Expert skywriter's Avatar
    Join Date
    06-09-2014
    Location
    USA
    MS-Off Ver
    2016
    Posts
    2,760

    Re: How to Get number of Day’s interval by Looping Through spreadsheet

    You should post an actual workbook.

    With a sample workbook. Make sure there is just enough data to demonstrate your need. Include a BEFORE sheet and an AFTER sheet in the workbook if needed to show the process you're trying to complete or automate. Make sure your desired results are shown, mock them up manually if necessary.
    Remember to desensitize the data.

    ViewPic
    Click the * Add Reputation button in the lower left hand corner of this post to say thanks.

    Don't forget to mark this thread SOLVED by going to the "Thread Tools" drop down list above your first post and choosing solved.

  3. #3
    Registered User
    Join Date
    06-27-2015
    Location
    USA
    MS-Off Ver
    2010
    Posts
    47

    Re: How to Get number of Day’s interval by Looping Through spreadsheet

    Solution provided by one of the the excel user was to use formula instead of VBA code. Sort the spreadsheet by "Key(Client+Product) Column E" and Call Date(Column D). Place the below formula "# of Day's Interval (F) - Expected Output Value"
    =IF(E2=E1, networkdays(D1,d2), 0)

    This solution works.

+ 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. Looping cannot be set to 1 mintues interval
    By cherrychan in forum Excel Programming / VBA / Macros
    Replies: 7
    Last Post: 02-03-2015, 09:25 PM
  2. Looping cannot be set to 1 mintues interval
    By cherrychan in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 02-03-2015, 01:04 PM
  3. Replies: 1
    Last Post: 04-29-2014, 04:42 AM
  4. Return value of interval number
    By jacvgraca in forum Excel Formulas & Functions
    Replies: 1
    Last Post: 01-13-2014, 12:39 PM
  5. looping at regular interval
    By grime in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 01-25-2006, 05:00 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