DatedIf Formula help

Sunshine8790

Board Regular
Joined
Jun 1, 2021
Messages
86
Office Version
  1. 365
Platform
  1. Windows
I have the below formula to help me calculate years for the current month based on a date in K2.
How can I modify this to reflect a new need?
I don't need it for current month anymore, I need to show how many years based on L2 (which contains only the year of the full date) for next year.

For example:
If the date in L2 is 2024, I need K2 to say "1".
If the date in K2 is 2015, I need K2 to say "10"

Excel Formula:
=IFERROR(DATEDIF(K2,EOMONTH(NOW(),0),"Y"),"Inactive")

Help appreciated :)
 

Excel Facts

Which lookup functions find a value equal or greater than the lookup value?
MATCH uses -1 to find larger value (lookup table must be sorted ZA). XLOOKUP uses 1 to find values greater and does not need to be sorted.
I don't think you need a DATEDIF here, just subtraction. If K2 is a date and L2 is a year only, then try this:
Excel Formula:
=IFERROR(L2+1-YEAR(K2),"error message")
and replace "error message" with whatever text you'd like if the formula errors.
 
Upvote 1
Solution
I don't think you need a DATEDIF here, just subtraction. If K2 is a date and L2 is a year only, then try this:
Excel Formula:
=IFERROR(L2+1-YEAR(K2),"error message")
and replace "error message" with whatever text you'd like if the formula errors.
Thank you!
 
Upvote 0

Forum statistics

Threads
1,223,886
Messages
6,175,191
Members
452,616
Latest member
intern444

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