+ Reply to Thread
Results 1 to 10 of 10

Counting days since last payment

  1. #1
    Registered User
    Join Date
    01-31-2014
    Location
    NJ, NJ
    MS-Off Ver
    Excel 2003
    Posts
    12

    Counting days since last payment

    Hey folks,

    Forum noob looking for help. I am trying to come up with a formula that will count the number of days since the last payment on a spreadsheet i'm working on. First column is my client, next is "Days without repayment," followed by a continually growing column for each business (bank) day (i.e., tomorrow, a new rightmost column will be created - "1/31/14"). I'd like that second column to return the number of days since a payment came in. (If payment received today, then 0; if paid yesterday, than 1 and so on), regardless of when the payments started or any payment gaps. The issue i am running into is that the data to be entered each day may be blank or entered as $0. But, essentially, I am looking to count the number of blank and/or $0 cells since a payment was received (not really a function of date since weekends will throw off the results).

    Any help would be greatly appreciated.

    Client Days Since Last Payment 1/23/14 1/24/14 1/27/14 1/28/14 1/29/14 1/30/14…
    a 0 $12.00 $44.00 $392.72 $45.00 $392.72
    b 1 $123.00 $123.00 $33.00 $7.00
    c 2 $22.00 $0.00 $22.00
    d 3 $4.00 $4.00 $-
    e.... 4 $555.00 0 $- $- $-

  2. #2
    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: Counting days since last payment

    Hi and welcome to the forum

    Often, a copy/paste into here messes up the formatting and makes it hard to see where data ends and starts
    Attach a sample workbook. Make sure there is just enough data to make it clear what is needed. 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 demonstrated, mock them up manually if needed. Remember to desensitize the data.

    Click on GO ADVANCED and use the paperclip icon to open the upload window.

    View Pic
    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

  3. #3
    Registered User
    Join Date
    01-31-2014
    Location
    NJ, NJ
    MS-Off Ver
    Excel 2003
    Posts
    12

    Re: Counting days since last payment

    Days without payment.xlsx

    Thanks for the insight and help, FDibbins.

    I've attached a mock up of what I am looking to do. Column B results have been manually entered but this is what I would like a formula for. Just count the number of $0 and/or blank cells since the last payment day to arrive at the numbers in Col B.

    Any help would be greatly appreciated! Thanks in advance, Excel Wizards.

  4. #4
    Forum Expert Tony Valko's Avatar
    Join Date
    12-31-2011
    Location
    Pittsburgh
    MS-Off Ver
    2002, 2007:2013
    Posts
    18,890

    Re: Counting days since last payment

    Can you explain which cells are being counted on rows 6 and 7. You have 3 and 4 as your expected results.
    Biff
    Microsoft MVP Excel
    Keep It Simple Stupid

    Let's Go Pens. We Want The Cup.

  5. #5
    Registered User
    Join Date
    01-31-2014
    Location
    NJ, NJ
    MS-Off Ver
    Excel 2003
    Posts
    12

    Re: Counting days since last payment

    First off, thank you for taking the time to look at this, Tony.

    I apologize for any confusion. Made a mistake. when i posted this. B6 should actually return "2" and B7 should return "3" since there are 2 and 3 blank cells, respectively.

    Sorry about that. <wiping egg off face>

  6. #6
    Forum Expert Tony Valko's Avatar
    Join Date
    12-31-2011
    Location
    Pittsburgh
    MS-Off Ver
    2002, 2007:2013
    Posts
    18,890

    Re: Counting days since last payment

    Try this...

    Entered in B3 and copied down:

    =IFERROR(IF(A3="","",COLUMNS(C3:G3)-LOOKUP(2,1/(C3:G3),COLUMN(C3:G3)-COLUMN(C3)+1)),COLUMNS(C3:G3))

  7. #7
    Registered User
    Join Date
    01-31-2014
    Location
    NJ, NJ
    MS-Off Ver
    Excel 2003
    Posts
    12

    Re: Counting days since last payment

    Sorry for not replying sooner. Thanks a lot for taking a further look at this, Tony. Unfortunately, though, your formula doesn't exactly work since everyday, a new column will be added. Thus, the following day, H2 would have 1/30/14, the day after would have I2 = 1/31/14...

    Any ideas? Really struggling with this one.

    Interesting formula, though. What exactly is the follow part:

    COLUMNS(C3:G3)-LOOKUP(2,1/(C3:G3),COLUMN(C3:G3)-COLUMN(C3)+1)

    Not very familiar with LOOKUP function and can't make heads or tails of it. Still trying to hone my excel chops!

  8. #8
    Forum Expert Tony Valko's Avatar
    Join Date
    12-31-2011
    Location
    Pittsburgh
    MS-Off Ver
    2002, 2007:2013
    Posts
    18,890

    Re: Counting days since last payment

    Quote Originally Posted by Xsiv View Post
    everyday, a new column will be added. Thus, the following day, H2 would have 1/30/14, the day after would have I2 = 1/31/14...
    Create a dynamic named range that refers to the dates on row 2.

    Goto the formulas tab>Define Name
    Name: Dates
    Refers to: =$C$2:INDEX($2:$2,MATCH(1E100,$2:$2))
    OK out

    Then, refer to a bigger range in the formula that allows for the new data being added. I'm using up to column Z as the end of range.

    =IFERROR(IF(A3="","",COLUMNS(Dates)-LOOKUP(2,1/(C3:Z3),COLUMN(C3:Z3)-COLUMN(C3)+1)),COLUMNS(Dates))

    What exactly is the follow part:

    COLUMNS(C3:G3)-LOOKUP(2,1/(C3:G3),COLUMN(C3:G3)-COLUMN(C3)+1)

    Not very familiar with LOOKUP function and can't make heads or tails of it. Still trying to hone my excel chops!
    The LOOKUP function finds the right-most numeric value in the row and returns that column number. That column number is subtracted from the last known column number that contains a date. However, since new data is added daily we have to tweak the formula as above to get the column number of the last entered date.

  9. #9
    Registered User
    Join Date
    01-31-2014
    Location
    NJ, NJ
    MS-Off Ver
    Excel 2003
    Posts
    12

    Re: Counting days since last payment

    That seems to work. Thank you, Tony. Much appreciated. And thanks for the explanation as well.

  10. #10
    Forum Expert Tony Valko's Avatar
    Join Date
    12-31-2011
    Location
    Pittsburgh
    MS-Off Ver
    2002, 2007:2013
    Posts
    18,890

    Re: Counting days since last payment

    You're welcome. Thanks for the feedback!


    If your question has been solved please mark the thread as being solved.

    In the menu bar above the very first post select Thread Tools, then select Mark this thread as solved.

+ 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. [SOLVED] Using days of the week to calculate payment to part-time workers
    By pschatz in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 12-07-2011, 12:53 AM
  2. Formula for counting monthly payment periods
    By Mondo in forum Excel General
    Replies: 2
    Last Post: 10-28-2010, 02:20 AM
  3. payment days Table
    By amygdalus in forum Excel General
    Replies: 3
    Last Post: 11-19-2009, 04:17 AM
  4. Replies: 9
    Last Post: 09-03-2007, 08:26 PM
  5. set payment date 28 days after following friday
    By rhydim in forum Excel General
    Replies: 3
    Last Post: 08-22-2006, 07:30 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