Return one of two dates depending on (numeric) day

megera716

Board Regular
Joined
Jan 3, 2013
Messages
146
Office Version
  1. 365
Platform
  1. Windows
I started out writing a different post, realized I was overthinking that and forgot to change the subject. I guess I just need it to return ONE date :)

We pay some large invoices on our corporate credit card and pay the card on the 25th of each month. If we charge something on January 26, it will be included in the payment leaving our bank account on February 25. If we pay something on February 24, that is also going out on February 25 (for the sake of simplicity, let's assume this hypothetical charge also cleared on the 24th). (We strategically time our charges to maximize "float" 🤑). I am trying to capture when cash will leave the bank for these invoices charged to the card.

T2 contains the invoice due date in MM/DD/YYYY (which is theoretically also the day we will pay it on the card).

In U2, I got as far as (not knowing how to write the result for if FALSE, I just finished it with a blank "")
=IF(DAY(T2)<=24,DATE(YEAR(T2),MONTH(T2),DAY(25)),"")

The invoice was due on 1/10/2024, so it should have returned 1/25/2024, but it returned 1/24/2024?

But if an invoice due date (column T) is the 25th or later of any given month, U2 should return the 25th of the next month and I'm struggling with that. EOMONTH+1 and subtract days? 😵
 

Excel Facts

Why are there 1,048,576 rows in Excel?
The Excel team increased the size of the grid in 2007. There are 2^20 rows and 2^14 columns for a total of 17 billion cells.
=IF(DAY(T2)<25,DATE(YEAR(T2),MONTH(T2),25),EOMONTH(T2,0)+25)
 
Upvote 1
Solution
Here is another possiblity:

Book1
TUV
1Invoice Due DatePayment DateExpected (Based on prose)
22024-01-012024-01-252024-01-25
32024-01-022024-01-252024-01-25
42024-01-032024-01-252024-01-25
52024-01-042024-01-252024-01-25
62024-01-052024-01-252024-01-25
72024-01-062024-01-252024-01-25
82024-01-072024-01-252024-01-25
92024-01-082024-01-252024-01-25
102024-01-092024-01-252024-01-25
112024-01-102024-01-252024-01-25
122024-01-112024-01-252024-01-25
132024-01-122024-01-252024-01-25
142024-01-132024-01-252024-01-25
152024-01-142024-01-252024-01-25
162024-01-152024-01-252024-01-25
172024-01-162024-01-252024-01-25
182024-01-172024-01-252024-01-25
192024-01-182024-01-252024-01-25
202024-01-192024-01-252024-01-25
212024-01-202024-01-252024-01-25
222024-01-212024-01-252024-01-25
232024-01-222024-01-252024-01-25
242024-01-232024-01-252024-01-25
252024-01-242024-01-252024-01-25
262024-01-252024-02-252024-02-25
272024-01-262024-02-252024-02-25
282024-01-272024-02-252024-02-25
292024-01-282024-02-252024-02-25
302024-01-292024-02-252024-02-25
312024-01-302024-02-252024-02-25
322024-01-312024-02-252024-02-25
332024-02-012024-02-252024-02-25
342024-02-022024-02-252024-02-25
352024-02-032024-02-252024-02-25
362024-02-042024-02-252024-02-25
372024-02-052024-02-252024-02-25
382024-02-062024-02-252024-02-25
392024-02-072024-02-252024-02-25
402024-02-082024-02-252024-02-25
412024-02-092024-02-252024-02-25
422024-02-102024-02-252024-02-25
432024-02-112024-02-252024-02-25
442024-02-122024-02-252024-02-25
452024-02-132024-02-252024-02-25
462024-02-142024-02-252024-02-25
472024-02-152024-02-252024-02-25
482024-02-162024-02-252024-02-25
492024-02-172024-02-252024-02-25
502024-02-182024-02-252024-02-25
512024-02-192024-02-252024-02-25
522024-02-202024-02-252024-02-25
532024-02-212024-02-252024-02-25
542024-02-222024-02-252024-02-25
552024-02-232024-02-252024-02-25
562024-02-242024-02-252024-02-25
572024-02-252024-03-252024-03-25
582024-12-232024-12-252024-12-25
592024-12-242024-12-252024-12-25
602024-12-252025-01-252025-01-25
612024-12-262025-01-252025-01-25
622024-12-272025-01-252025-01-25
Sheet5
Cell Formulas
RangeFormula
U2:U62U2=DATE(YEAR(T2),MONTH(T2)+IF(DAY(T2)<25,0,1),25)
T59:T62T59=T58+1
 
Upvote 0

Forum statistics

Threads
1,223,888
Messages
6,175,208
Members
452,618
Latest member
Tam84

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