YearFrac and Leap Year.

Highworld

New Member
Joined
Jan 31, 2023
Messages
17
Office Version
  1. 365
Platform
  1. Windows
Hello,

Was looking for some help on this situation. I am trying to see if there would be a better way for this formula as it is causing issues during leap years.

1710275487764.png


the Yearfrac is pulling from the following details.

1710275527001.png


I would be open to changing the formula to work with leapyears going forward but not sure how about to go with that situation.
 

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.
what kind of values are in cells: I35, I34, D31,G31,I30,I31,G32,G31? A mini table or xl2bb min worksheet (link below) would be very helpful.
 
Upvote 0
That is neither a table or a mini xl2bb worksheet? Are there any formula
I am trying to post it but my computer is not liking the XL2BB program install. Not sure if this will work this way as there are formulas within the table.

EmployerPay Period Ending
YTD
20232022TRUEMonth
2​
Uncheck box if not using to qualifyTRUETRUE
FALSE
1Day
10​
Gross Wages28
Year
2021​
Overtime28
Commission505Start Date
#######​
Bonus505Paid Thru
#######​
Other
Total Qualifying from Paystub/VOE$0.00$0.00$0.004.733333
Monthly$0.00
TRUE​
TRUE​
TRUE​
 
Upvote 0
I understand that add ins can be disallowed on work computers. This helps. Can copy and paste the formulas and tell us what cells they are in? But, this may be enough for some people to try to get you a solution?
Thanks.
 
Upvote 0
I understand that add ins can be disallowed on work computers. This helps. Can copy and paste the formulas and tell us what cells they are in? But, this may be enough for some people to try to get you a solution?
Thanks.

This is the formula in question that I am having issues with. It is located in cell G10 from the attached screenshot.
=IF(G3=TRUE,YEARFRAC(I8,I7)*12,IF(D4=TRUE,(G4*12)+(I3-1)+(I4/G5),G4*12))


1710281556750.png
 
Upvote 0
I think you have something misaligned. The cells colored PINK are in your formula and have no value in the worksheet.
Please give (type cellref: Value, for each value) data for inputs, and an expected outcome in cell G10.
Somehting like
G3: ###
G4: ###
G5: ###
I3: ##
I4: ##

Expect: G10: #####

Or maybe you can tell us just what is it you are trying to calculate?


Book1
ABCDEFGHIJ
1
2Employer:
3YTD20232022Month
4If Not Using to QualifyTRUETRUEFALSEDay
5Gross WagesYear
6OvertimeStarted after 1/1
7CommissionStart Date2023-09-18
8BonusPaid Thru2024-02-10
9Other
10Earning from PS/VOE$ 0.00$ 0.00$ 0.00#DIV/0!
11Monthly
12
Sheet1
Cell Formulas
RangeFormula
D4:E4D4=TRUE()
F4F4=FALSE()
D10:F10D10=SUM(D4:D9)
G10G10=IF(G3=TRUE,YEARFRAC(I7,I8)*12,IF(D4=TRUE,(G4*12)+(I3-1)+(I4/G5),G4*12))
 
Upvote 0
Would something like this work for you ?
(I have taken the fraction of the month to be based on the End Month)
You would need to add your conditions if the principle works.

Excel Formula:
=LET(ptMths,DATEDIF(I7,I8,"m"),
            ptDays,I8-EDATE(I7,ptMths),
            ptMths+(ptDays/DAY(EOMONTH(I8,0))))
 
Upvote 0

Forum statistics

Threads
1,223,214
Messages
6,170,772
Members
452,353
Latest member
strainu

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