Modifying Formula to Show Days Till Next Presidential Election Day.

Sh8dyDan

New Member
Joined
Dec 20, 2023
Messages
25
Office Version
  1. 365
Platform
  1. Windows
I need some help figuring out how to modify these two formulas. They work as expected. Instead of showing a blank when not election or inauguration year I'd like to show days till the next date.

Presidential Election Day
Excel Formula:
=IF(MOD(YEAR(Timesheet!$E$22),4)=0,DATE(YEAR(Timesheet!$E$22),11,6)-(WEEKDAY(DATE(YEAR(Timesheet!$E$22),11,6))-2)+1,"")

Presidential Inauguration Day
Excel Formula:
=IF(MOD(YEAR(Timesheet!$E$22)-1,4)=0,DATE(YEAR(Timesheet!$E$22),1,20)+CHOOSE(WEEKDAY(DATE(YEAR(Timesheet!$E$22),1,20)),1,0,0,0,0,0,0),"")
 
The Presidential Election Day formula will return the date for Tuesday after the first Monday of November for every year divisible by four. If the year is not divisible by four it will be FALSE and blank. Instead of showing blank, I'd like it to show days remaining until the formula is TRUE.

Dates are in M/D/Y format.

2023 Paycheck Calculator - V2 - 07.xlsx
E
21Start Date
2210/7/2023
Timesheet

2023 Paycheck Calculator - V2 - 07.xlsx
DEFGHIJKLM
58Presidential Election DayObservedUSTuesday after first Monday of NovemberPublicDays till TRUE🗳️ 🗳️
59Presidential Inauguration DayObservedUS20th day of JanuaryFederalDays till TRUE  
Holidays
Cell Formulas
RangeFormula
I58I58=IF(MOD(YEAR(Timesheet!$E$22),4)=0,DATE(YEAR(Timesheet!$E$22),11,6)-(WEEKDAY(DATE(YEAR(Timesheet!$E$22),11,6))-2)+1,"Days till TRUE")
K58,M58K58=IF($P58=TRUE,"🗳️ ","")
E58:E59E58=IF($P53=TRUE,"Observed","Not Observed")
I59I59=IF(MOD(YEAR(Timesheet!$E$22)-1,4)=0,DATE(YEAR(Timesheet!$E$22),1,20)+CHOOSE(WEEKDAY(DATE(YEAR(Timesheet!$E$22),1,20)),1,0,0,0,0,0,0),"Days till TRUE")
J59,L59J59=IF(MOD(YEAR(Timesheet!$E$22)-1,4)=0,DATE(YEAR(Timesheet!$E$22),1,20)+CHOOSE(WEEKDAY(DATE(YEAR(Timesheet!$E$22),1,20)),1,0,0,0,0,0,0),"")
K59,M59K59=IF($P59=TRUE,"✋ ","")
 
Upvote 0

Excel Facts

What is the shortcut key for Format Selection?
Ctrl+1 (the number one) will open the Format dialog for whatever is selected.
2023 Paycheck Calculator - V2 - 07.xlsx
E
21Start Date
2210/7/2024
Timesheet

2023 Paycheck Calculator - V2 - 07.xlsx
DEFGHIJKLM
58Presidential Election DayObservedUSTuesday after first Monday of NovemberPublicTuesday, November 5, 2024🗳️ 🗳️
59Presidential Inauguration DayObservedUS20th day of JanuaryFederalDays till TRUE  
Holidays
Cell Formulas
RangeFormula
I58I58=IF(MOD(YEAR(Timesheet!$E$22),4)=0,DATE(YEAR(Timesheet!$E$22),11,6)-(WEEKDAY(DATE(YEAR(Timesheet!$E$22),11,6))-2)+1,"Days till TRUE")
K58,M58K58=IF($P58=TRUE,"🗳️ ","")
E58:E59E58=IF($P53=TRUE,"Observed","Not Observed")
I59I59=IF(MOD(YEAR(Timesheet!$E$22)-1,4)=0,DATE(YEAR(Timesheet!$E$22),1,20)+CHOOSE(WEEKDAY(DATE(YEAR(Timesheet!$E$22),1,20)),1,0,0,0,0,0,0),"Days till TRUE")
J59,L59J59=IF(MOD(YEAR(Timesheet!$E$22)-1,4)=0,DATE(YEAR(Timesheet!$E$22),1,20)+CHOOSE(WEEKDAY(DATE(YEAR(Timesheet!$E$22),1,20)),1,0,0,0,0,0,0),"")
K59,M59K59=IF($P59=TRUE,"✋ ","")


2023 Paycheck Calculator - V2 - 07.xlsx
E
2210/7/2025
2310
Timesheet
Cell Formulas
RangeFormula
E23E23=IF($AI$6=1,10,IF($AI$6=2,12,))

2023 Paycheck Calculator - V2 - 07.xlsx
DEFGHIJKLM
58Presidential Election DayObservedUSTuesday after first Monday of NovemberPublicDays till TRUE🗳️ 🗳️
59Presidential Inauguration DayObservedUS20th day of JanuaryFederalMonday, January 20, 2025Monday, January 20, 2025Monday, January 20, 2025
Holidays
Cell Formulas
RangeFormula
I58I58=IF(MOD(YEAR(Timesheet!$E$22),4)=0,DATE(YEAR(Timesheet!$E$22),11,6)-(WEEKDAY(DATE(YEAR(Timesheet!$E$22),11,6))-2)+1,"Days till TRUE")
K58,M58K58=IF($P58=TRUE,"🗳️ ","")
E58:E59E58=IF($P53=TRUE,"Observed","Not Observed")
I59I59=IF(MOD(YEAR(Timesheet!$E$22)-1,4)=0,DATE(YEAR(Timesheet!$E$22),1,20)+CHOOSE(WEEKDAY(DATE(YEAR(Timesheet!$E$22),1,20)),1,0,0,0,0,0,0),"Days till TRUE")
J59,L59J59=IF(MOD(YEAR(Timesheet!$E$22)-1,4)=0,DATE(YEAR(Timesheet!$E$22),1,20)+CHOOSE(WEEKDAY(DATE(YEAR(Timesheet!$E$22),1,20)),1,0,0,0,0,0,0),"")
K59,M59K59=IF($P59=TRUE,"✋ ","")
 
Upvote 0
I'm guessing that in I59 of the first mini sheet and I58 of the second mini sheet you don't actually want the text "Days till TRUE" but some other value. What I mean by ..
concrete examples of the actual expected results for both formulas
.. is
what actual value do you want in I59 of the first mini sheet for 10/7/2024 in E22 of Timesheet, and
what actual value do you want in I58 of the second mini sheet for 10/7/2025 in E22 of Timesheet?
 
Upvote 0
The days left when the formula will be TRUE again 4 years in the future from E22 on Timesheet in 2028.
 
Upvote 0
Book1
DEF
5FutureDays
6E224 YearsTill
710/7/202410/7/20281461
Sheet1
Cell Formulas
RangeFormula
F7F7=E7-D7
 
Upvote 0
With the date now Oct 7 2024, consider the following

T202401a.xlsm
DEFGHIJ
1Days to election2024Tue Nov 5, 2024
22028Tue Nov 7, 2028
32032Tue Nov 2, 2032
42036Tue Nov 4, 2036
5NextSubsequent2040Tue Nov 6, 2040
607-Oct-23Tue 05-Nov-2439518582044Tue Nov 1, 2044
707-Oct-24Tue 05-Nov-24291492
830-Sep-28Tue 07-Nov-28381494
9
57
58Presidential Election DayNot ObservedUSTuesday after first Monday of NovemberPublicTue Nov 5, 2024
59291492
60291492
61
1e
Cell Formulas
RangeFormula
F6:F8F6=XLOOKUP(E6,$J$1:$J$6,$J$1:$J$6,,1)
G6:G8G6=XLOOKUP(E6,$J$1:$J$6,$J$1:$J$6,,1)-E6
H6:H8H6=XLOOKUP(E6+G6+1,$J$1:$J$6,$J$1:$J$6,,1)-E6
J1:J6J1=WORKDAY.INTL(DATE(I1,11,0),1,"1011111")
I59I59=LET(a,TimeSheet!$E$22,p,$J$1:$J$6,XLOOKUP(a,p,p,,1)-a)
J59J59=LET(a,TimeSheet!$E$22+I59+1,p,$J$1:$J$6,XLOOKUP(a,p,p,,1)-TimeSheet!$E$22)
I60I60=LET(a,TimeSheet!$E$22,p,{45601;47064;48520;49983;51446;52902},XLOOKUP(a,p,p,,1)-a)
J60J60=LET(a,TimeSheet!$E$22+I60+1,p,{45601;47064;48520;49983;51446;52902},XLOOKUP(a,p,p,,1)-TimeSheet!$E$22)
 
Last edited:
Upvote 0
See if the following formulas work for you:
Excel Formula:
=WORKDAY.INTL(CEILING(YEAR(Timesheet!$E$22),4)&"-10-31",1,"0111111")+1-IF(MOD(YEAR(Timesheet!$E$22),4),Timesheet!$E$22,0)
=WORKDAY.INTL(CEILING(YEAR(Timesheet!$E$22)-1,4)+1&"-01-19",1,11)-IF(MOD(YEAR(Timesheet!$E$22),4)=1,0,Timesheet!$E$22)
Note: Custom-format the cells as [<2000]#;m/d/yyyy
 
Upvote 1
Solution
See if the following formulas work for you:
Excel Formula:
=WORKDAY.INTL(CEILING(YEAR(Timesheet!$E$22),4)&"-10-31",1,"0111111")+1-IF(MOD(YEAR(Timesheet!$E$22),4),Timesheet!$E$22,0)
=WORKDAY.INTL(CEILING(YEAR(Timesheet!$E$22)-1,4)+1&"-01-19",1,11)-IF(MOD(YEAR(Timesheet!$E$22),4)=1,0,Timesheet!$E$22)
Note: Custom-format the cells as [<2000]#;m/d/yyyy
The first formula is the one that works.

I had only just recently worked out a brute force option with IF Statements.
But your way is more elegant.

Thanks for the custom formatting tip. (y)

Thank you, Thank you, Thank you!

Dan N.

⭐⭐⭐
Excel Formula:
=WORKDAY.INTL(CEILING(YEAR(Timesheet!$E$22),4)&"-10-31",1,"0111111")+1-IF(MOD(YEAR(Timesheet!$E$22),4),Timesheet!$E$22,0)
Note: Custom-format the cells as [<2000]#;m/d/yyyy
⭐⭐⭐
 
Upvote 0

Forum statistics

Threads
1,215,108
Messages
6,123,129
Members
449,097
Latest member
mlckr

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