• Hi All

    Please note that at the Chandoo.org Forums there is Zero Tolerance to Spam

    Post Spam and you Will Be Deleted as a User

    Hui...

  • When starting a new post, to receive a quicker and more targeted answer, Please include a sample file in the initial post.

calculate number of days taken to pay

You would use running totals (accumulation) for both the sales and payments and look up the dates.
Code:
= LET(
    sale,      FILTER(sales, sales>0),
    salesDate, FILTER(date, sales>0),
    salesAcc,  SCAN(0, sale, SUM),
    pmntsAcc,  SCAN(0, payments, SUM),
    pmntDate,  XLOOKUP(salesAcc, pmntsAcc, date, "unpaid", 1),
    HSTACK(sale, pmntDate, pmntDate-salesDate)
  )
The resulting table is
1724578419359.png
If you want to show the payment days as part of the original table then output "" for lines without sales rather than filtering them out.

I have just added a Lambda function variant.
Code:
= PaymentDaysλ(sales, payments, date)
 

Attachments

Last edited:
Back
Top