=IF formula

Lauren22newell

New Member
Joined
Jul 25, 2024
Messages
8
Office Version
  1. 365
Platform
  1. Windows
  2. Web
Hi all,

I'm new here but have been working on a spreadsheet to help me with managing a new client list over the past few days and have found this forum so helpful.

I have imagined a formula in my head that I'd find really helpful to use but I'm not sure how to go about it.

In column F, I have calculated a deadline day for filing accounts. In column G, I'd like to have a formula that picks out how many days or months between that deadline and today, and shows up as "Due in X days or X months" - Is this possible? I've done one I found on here for deadlines in the current month, so it shows "due this month" but I'm not sure how to go about this one.

Any help would be much appreciated. Thank you!
 
Thank you so much for your help on this, I really appreciate it! I wish I had the skill to know how to write them but I'm trying to read the ones you've sent and pick up on them!
 
Upvote 0

Excel Facts

How to change case of text in Excel?
Use =UPPER() for upper case, =LOWER() for lower case, and =PROPER() for proper case. PROPER won't capitalize second c in Mccartney
Building on @etaf's work, this might be a bit longer but might be simpler and will work across years.
PS: I would suggest putting TODAY() in a cell that you reference and not in a formula.
It will give you the flexibility to backdate the date if you need to and try different dates when you are testing.

In G2
Excel Formula:
=LET(mths,(YEAR(F2)-YEAR(TODAY()))*12+(MONTH(F2)-MONTH(TODAY())),
     SWITCH(mths,
       0,"Due This Month",
       1,"Due Next Month",
       2,"Due in 1 Month",
       "Due in " & mths & " Months"))
 
Upvote 0
Hi Alex,

This looks great, thank you for taking the time to build on @etaf's help. I have pasted this into my column G2 but it is throwing out #NAME - Screenshot below.

Sorry, I am a bit lost with the TODAY() bit - Please could you explain? Promise I'm not a silly person but still very much learning on Excel!

1721983038644.png
 
Upvote 0

Alex Blakenburg

Has a better solution , although that is 1 month out , as i was , Sept saying 1 month Oct saying 2 months, is that what you want , I changed to say 2 months for sept

as it was getting complicated with nested IF's

However for completeness , this will take into account now if today is december and F2 is Jan ,
BUT will NOT take into account Years
So aug 25 , will be seen as next month


=IF(MONTH(TODAY())=MONTH(F2),"Due This Month",IF(OR(MONTH(F2)-MONTH(TODAY())=1,MONTH(F2)-MONTH(TODAY())=-11),"Due Next Month",
IF(MONTH(F2)>MONTH(TODAY()),MONTH(F2)-MONTH(TODAY())&" month",
12-MONTH(TODAY())+MONTH(F2)&" month")))

Book5
FG
1deadline
28/1/24Due Next Month
39/12/242 month
410/24/243 month
512/5/245 month
61/16/256 month
72/27/257 month
84/10/259 month
97/27/24Due This Month
107/29/24Due This Month
117/31/24Due This Month
128/2/24Due Next Month
138/4/24Due Next Month
148/6/24Due Next Month
158/8/24Due Next Month
168/10/24Due Next Month
178/12/24Due Next Month
188/14/24Due Next Month
198/16/24Due Next Month
208/18/24Due Next Month
218/20/24Due Next Month
228/22/24Due Next Month
238/24/24Due Next Month
248/25/24Due Next Month
258/28/24Due Next Month
268/30/24Due Next Month
277/1/25Due This Month
288/3/25Due Next Month
299/5/242 month
3010/7/243 month
3111/9/244 month
329/11/242 month
339/13/242 month
349/15/242 month
359/17/242 month
369/19/242 month
379/21/242 month
389/23/242 month
399/25/242 month
Sheet1
Cell Formulas
RangeFormula
G2:G39G2=IF(MONTH(TODAY())=MONTH(F2),"Due This Month",IF(OR(MONTH(F2)-MONTH(TODAY())=1,MONTH(F2)-MONTH(TODAY())=-11),"Due Next Month", IF(MONTH(F2)>MONTH(TODAY()),MONTH(F2)-MONTH(TODAY())&" month", 12-MONTH(TODAY())+MONTH(F2)&" month")))



with Alex solution
Cell Formulas
RangeFormula
G2:G39G2=IF(MONTH(TODAY())=MONTH(F2),"Due This Month",IF(OR(MONTH(F2)-MONTH(TODAY())=1,MONTH(F2)-MONTH(TODAY())=-11),"Due Next Month", IF(MONTH(F2)>MONTH(TODAY()),MONTH(F2)-MONTH(TODAY())&" month", 12-MONTH(TODAY())+MONTH(F2)&" month")))
H2:H39H2=LET(mths,(YEAR(F2)-YEAR(TODAY()))*12+(MONTH(F2)-MONTH(TODAY())), SWITCH(mths, 0,"Due This Month", 1,"Due Next Month", 2,"Due in 1 Month", "Due in " & mths & " Months"))
 
Upvote 1
You are all brilliant and so patient and helpful! This has worked and I now have a due column that works!!! :D

1721983724505.png
 
Upvote 0
Good catch by etaf, I made a couple of errors.
You need to copy it straight into the "Formula box" of G2 or H2
Excel Formula:
=LET(mths,(YEAR(F2)-YEAR(TODAY()))*12+(MONTH(F2)-MONTH(TODAY())),
     SWITCH(mths,
       0,"Due This Month",
       1,"Due Next Month",
       "Due in " & mths & " Months"))
 
Upvote 1
Solution
you are very welcome


Cell Formulas
RangeFormula
G2:G39G2=IF(MONTH(TODAY())=MONTH(F2),"Due This Month",IF(OR(MONTH(F2)-MONTH(TODAY())=1,MONTH(F2)-MONTH(TODAY())=-11),"Due Next Month", IF(MONTH(F2)>MONTH(TODAY()),MONTH(F2)-MONTH(TODAY())&" month", 12-MONTH(TODAY())+MONTH(F2)&" month")))
H2:H39H2=LET(mths,(YEAR(F2)-YEAR(TODAY()))*12+(MONTH(F2)-MONTH(TODAY())), SWITCH(mths, 0,"Due This Month", 1,"Due Next Month", "Due in " & mths & " Months"))
 
Upvote 1

Forum statistics

Threads
1,223,885
Messages
6,175,183
Members
452,615
Latest member
bogeys2birdies

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