Days in Between Orders Datedif?

john62290

New Member
Joined
Dec 15, 2021
Messages
28
Office Version
  1. 365
Platform
  1. Windows
Hi. I am looking for a formula that calculates the number of days in between orders for multiple accounts. If the order number is 1, it would be blank but would like a formula to return 9 for 4/10/2024 ABC and 5 for 4/15/2024 ABC. Thanks!
DateAccount NameOrder NumberDays in Between Orders
4/1/2024ABC1-
4/2/2024XYC1-
4/2/2024AAA1
4/10/2024ABC2
4/11/2024LLL1
4/15/2024ABC3
4/17/2024ABC4
4/20/2024XYC2
4/30/2024XYC3
5/1/2024LLL2
 

Excel Facts

Which Excel functions can ignore hidden rows?
The SUBTOTAL and AGGREGATE functions ignore hidden rows. AGGREGATE can also exclude error cells and more.
Excel Formula:
=LET(co,$A2,lo,INDEX($A$2:$A$11,XMATCH(1,($B$2:$B$11=$B2)*($C$2:$C$11=($C2-1)))),IF($C2=1,"",co-lo))
 
Upvote 0
Solution
LET function allows you to assign variable names to be used later in the function. I chose CO for Current Order, and LO for Last Order, but you can use anything you want. Alternatively, you could make the same function without using let, but it would be longer and harder to understand.
 
Upvote 0

Forum statistics

Threads
1,216,057
Messages
6,128,521
Members
449,456
Latest member
SammMcCandless

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top