Working Days differerence between 2 cells

Trie1977

New Member
Joined
Mar 7, 2022
Messages
22
Office Version
  1. 2019
Platform
  1. Windows
Hi,

I was wondering what the formula is to get the difference of working days between the swings (G column).

2020-03-15 is the last current known swing, 2022-02-10 was the previous swing, and so on.

Thanks in advance.

Trading Data All.xlsx
ABCDEFGHIJKL
1DateTimeframeOpenHighLowCloseSwingsPipsOpbouwFibRatiosTimeDiffColumn1
22022-03-18Daily1,31471,31501,31451,315058FALSE
32022-03-17Daily1,31461,32111,30871,314957FALSE
42022-03-16Daily1,30391,31571,30301,314731FALSE
52022-03-15Daily1,30001,30891,29991,30421,2999-644-80-225,5%#VALUE!
62022-03-14Daily1,30391,30791,30011,3001-46FALSE
72022-03-11Daily1,30831,31251,30281,3036-70FALSE
82022-03-10Daily1,31751,31951,30811,30845FALSE
92022-03-09Daily1,30991,31901,30881,318745FALSE
102022-03-08Daily1,31031,31451,30821,3100-99FALSE
112022-03-07Daily1,32211,32431,31021,3103-109FALSE
122022-03-04Daily1,33441,33521,32021,3231-66FALSE
132022-03-03Daily1,34041,34181,33181,334911FALSE
142022-03-02Daily1,33181,34071,32721,3405-31FALSE
152022-03-01Daily1,34171,34381,33021,33246FALSE
162022-02-28Daily1,33091,34321,33091,3420-7FALSE
172022-02-25Daily1,33731,34391,33671,3409-111FALSE
182022-02-24Daily1,35411,35491,32731,3377-71FALSE
192022-02-23Daily1,35741,36211,35361,354716FALSE
202022-02-22Daily1,36001,36051,35381,3586-34FALSE
212022-02-21Daily1,35861,36391,35841,3600-4FALSE
222022-02-18Daily1,36141,36431,35731,35955FALSE
232022-02-17Daily1,35821,36381,35561,361437FALSE
242022-02-16Daily1,35341,36011,35261,357934FALSE
252022-02-15Daily1,35191,35671,34871,3540-5FALSE
262022-02-14Daily1,35511,35721,34951,3533-38FALSE
272022-02-11Daily1,35531,36101,35141,3560-34FALSE
282022-02-10Daily1,35341,36441,35231,35611,3644286117-73,1%29720
292022-02-09Daily1,35381,35891,35271,353419FALSE
302022-02-08Daily1,35351,35641,35081,354817FALSE
312022-02-07Daily1,35331,35511,34911,3536-14FALSE
322022-02-04Daily1,35961,36151,35051,3527-33FALSE
332022-02-03Daily1,35741,36281,35381,359923FALSE
342022-02-02Daily1,35161,35871,35151,357687FALSE
352022-02-01Daily1,34431,35281,34281,352441FALSE
362022-01-31Daily1,33931,34601,33871,344522FALSE
372022-01-28Daily1,33791,34331,33651,33957FALSE
382022-01-27Daily1,34611,34681,33581,33811,3358-391-167-66,5%29710
392022-01-26Daily1,34931,35251,34451,34656FALSE
402022-01-25Daily1,34851,35191,34361,3500-47FALSE
412022-01-24Daily1,35511,35651,34411,3490-37FALSE
422022-01-21Daily1,35991,36021,35461,3553-60FALSE
432022-01-20Daily1,36101,36621,35871,359813FALSE
442022-01-19Daily1,35921,36491,35871,3612-13FALSE
452022-01-18Daily1,36421,36621,35731,3598-28FALSE
462022-01-17Daily1,36741,36901,36371,3645-53FALSE
472022-01-14Daily1,37071,37431,36531,3683-6FALSE
482022-01-13Daily1,36961,37491,36961,37021,3749588128-87,3%29700
492022-01-12Daily1,36331,37141,36211,370059FALSE
502022-01-11Daily1,35761,36361,35621,363429FALSE
512022-01-10Daily1,35801,36041,35321,35755FALSE
522022-01-07Daily1,35271,35981,35271,359237FALSE
532022-01-06Daily1,35511,35591,34901,3535-32FALSE
542022-01-05Daily1,35281,35991,35221,355663FALSE
552022-01-04Daily1,34751,35571,34591,352829FALSE
562022-01-03Daily1,35291,35331,34311,3477-35FALSE
572021-12-31Daily1,34921,35501,34651,354211FALSE
582021-12-30Daily1,34871,35221,34541,350246FALSE
592021-12-29Daily1,34291,35001,34091,3487-6FALSE
602021-12-28Daily1,34401,34621,34151,342925FALSE
612021-12-27Daily1,33921,34451,33891,34435FALSE
622021-12-24Daily1,34041,34201,33851,339244FALSE
632021-12-23Daily1,33471,34381,33411,3411100FALSE
642021-12-22Daily1,32511,33631,32401,334943FALSE
652021-12-21Daily1,32051,32711,31981,326924FALSE
662021-12-20Daily1,32401,32451,31731,3209-57FALSE
672021-12-17Daily1,33191,33391,32311,3234-11FALSE
682021-12-16Daily1,32571,33751,32421,332370FALSE
692021-12-15Daily1,32301,32831,31721,3259-19FALSE
702021-12-14Daily1,32121,32561,31911,3227-16FALSE
712021-12-13Daily1,32461,32691,32071,321220FALSE
722021-12-10Daily1,32201,32761,31871,326317FALSE
732021-12-09Daily1,32011,32231,31711,321910FALSE
742021-12-08Daily1,32411,32611,31611,32021,3161-673-128-159,4%29674
752021-12-07Daily1,32621,32891,32091,32423FALSE
Time2Swings
Cell Formulas
RangeFormula
L2:L4L2=IF(G2<>0,NETWORKDAYS(A:A,A:A))
L5L5=IF(G5<>0,NETWORKDAYS(IF(G3:G500,">0",0),A2,A28))
L6:L75L6=IF(G6<>0,NETWORKDAYS(IF(G3:G501>0,2999),A3,A29))
Named Ranges
NameRefers ToCells
ExternalData_4=Time2Swings!$A$1:$F$691L2:L4
 

Excel Facts

What is =ROMAN(40) in Excel?
The Roman numeral for 40 is XL. Bill "MrExcel" Jelen's 40th book was called MrExcel XL.
Maybe:
Excel Formula:
=NETWORKDAYS(LARGE(IF(G1:G1000<>"",A1:A1000,""),ROW(A2)),LARGE(IF(G1:G1000<>"",A1:A1000,""),ROW(A1)))
To be inserted using Contr-Shift-Enter, not Enter alone.
If you have more than 1000 lines then increase those "1000" to 2000 or 5000 or 10000 (a safe value, but avoid 1000000)

The copy down

Bye
 
Upvote 0
Another option
+Fluff 1.xlsm
ABCDEFGHIJKL
1DateTimeframeOpenHighLowCloseSwingsPipsOpbouwFibRatiosTimeDiffColumn1
218/03/2022Daily1.314741.314961.314511.3149657.7 
317/03/2022Daily1.314621.321111.308741.3149357 
416/03/2022Daily1.303931.315661.303041.3147431.1 
515/03/2022Daily1.299961.308871.299931.304211.29993-644.4-79.8-2.2547224
614/03/2022Daily1.303861.307911.300051.30007-45.8 
711/03/2022Daily1.308321.312491.302761.30359-69.7 
810/03/2022Daily1.317531.319461.308141.308364.9 
909/03/2022Daily1.309921.318971.308811.3186645.1 
1008/03/2022Daily1.310321.314461.308211.30995-98.6 
1107/03/2022Daily1.322141.324321.310191.31031-109.1 
1204/03/2022Daily1.33441.335231.320241.32308-65.6 
1303/03/2022Daily1.340351.341791.331761.3348711.1 
1402/03/2022Daily1.331811.340681.327151.34045-30.7 
1501/03/2022Daily1.341661.343751.330231.332415.9 
1628/02/2022Daily1.330921.343161.330921.34196-7.2 
1725/02/2022Daily1.337261.343881.336671.34089-110.5 
1824/02/2022Daily1.354061.354931.327291.33768-71.2 
1923/02/2022Daily1.357411.362051.353591.3547115.6 
2022/02/2022Daily1.359951.360491.353841.35856-33.7 
2121/02/2022Daily1.358591.363861.35841.36-4.2 
2218/02/2022Daily1.361371.364281.357321.35954.7 
2317/02/2022Daily1.358191.363811.355571.3614237.2 
2416/02/2022Daily1.353351.360091.352581.3579433.8 
2515/02/2022Daily1.35191.356711.348651.35402-4.8 
2614/02/2022Daily1.355061.357191.349511.35326-37.6 
2711/02/2022Daily1.355271.360951.35141.35595-34.2 
2810/02/2022Daily1.353381.364371.352311.356141.36437285.8116.7-0.7309511
2909/02/2022Daily1.353811.358941.35271.3534319.4 
3008/02/2022Daily1.353481.356391.350761.3547817.1 
3107/02/2022Daily1.353261.355081.349051.35355-14.2 
3204/02/2022Daily1.359561.361481.350471.35272-33.2 
3303/02/2022Daily1.357381.362781.353791.3598722.8 
3402/02/2022Daily1.35161.358691.351511.3576187.2 
3501/02/2022Daily1.344331.352811.342791.352441.1 
3631/01/2022Daily1.339291.346031.338681.3444821.6 
3728/01/2022Daily1.337861.343291.336521.33957.3 
3827/01/2022Daily1.346071.346781.335791.33811.33579-391-166.8-0.6650811
3926/01/2022Daily1.349321.352471.344451.346515.9 
4025/01/2022Daily1.348471.351881.343621.35001-46.6 
4124/01/2022Daily1.35511.356541.344051.34898-36.9 
4221/01/2022Daily1.359921.360231.354581.3553-59.7 
4320/01/2022Daily1.3611.36621.358711.3598413.3 
4419/01/2022Daily1.359171.364871.358651.36122-12.9 
4518/01/2022Daily1.364231.366161.35731.35977-28.4 
4617/01/2022Daily1.367351.3691.363731.36449-52.8 
4714/01/2022Daily1.370741.374281.365341.3683-6.1 
4813/01/2022Daily1.369641.374891.369641.370211.37489587.9128.1-0.8731627
4912/01/2022Daily1.363281.371411.362081.3700259.2 
5011/01/2022Daily1.357581.363631.356161.3633529.3 
5110/01/2022Daily1.358041.360371.353231.357515.2 
5207/01/2022Daily1.352741.359751.352711.3591736.9 
5306/01/2022Daily1.355141.355881.349021.35345-32.2 
5405/01/2022Daily1.352751.359861.352241.3555663 
5504/01/2022Daily1.347521.355741.345941.3528228.6 
5603/01/2022Daily1.352931.353341.343081.34772-34.6 
5731/12/2021Daily1.349171.355041.346541.3541711 
5830/12/2021Daily1.348681.352171.345441.3502345.7 
5929/12/2021Daily1.342931.349961.340871.3487-6.1 
6028/12/2021Daily1.344021.346161.341481.342925.4 
6127/12/2021Daily1.33921.344511.338941.344294.8 
6224/12/2021Daily1.340421.341961.338461.339244 
6323/12/2021Daily1.334731.343771.334061.34112100.3 
6422/12/2021Daily1.325131.336311.324031.3349242.7 
6521/12/2021Daily1.32051.327081.319761.3269124.2 
6620/12/2021Daily1.323961.324471.317341.32093-57.3 
6717/12/2021Daily1.331871.333921.323071.32343-10.8 
6816/12/2021Daily1.325691.337451.324151.3322669.7 
6915/12/2021Daily1.323011.328271.317181.32589-19.1 
7014/12/2021Daily1.321161.325641.319091.32273-16.4 
7113/12/2021Daily1.324641.326871.320731.3211719.9 
7210/12/2021Daily1.321951.327571.318741.3262916.6 
7309/12/2021Daily1.320051.322261.317081.321859.8 
7408/12/2021Daily1.324051.326121.31611.320211.3161-673.3-128.4-1.59436 
7507/12/2021Daily1.326231.328941.320911.324213.1 
Main
Cell Formulas
RangeFormula
L2:L75L2=IF(G2="","",IFERROR(NETWORKDAYS(AGGREGATE(14,6,A3:A$1000/(G3:G$1000<>""),1),A2),""))
 
Upvote 0
Hi both,

Thanks for the input.

I tried both but don't get the right results; But if I copy the table of Fluff I do get the right results.
What's wrong with my table?

By the way, I did use (Press CTRL+SHIFT+ENTER to enter array formulas.)


Trading Data All.xlsx
ABCDEFGHIJKL
1DateTimeframeOpenHighLowCloseSwingsPipsOpbouwFibRatiosAnthony47Fluff
22022-03-18Daily1,31471,31501,31451,3150585 
32022-03-17Daily1,31461,32111,30871,31495717 
42022-03-16Daily1,30391,31571,30301,31473110 
52022-03-15Daily1,30001,30891,29991,30421,2999-644-80######102
62022-03-14Daily1,30391,30791,30011,3001-463 
72022-03-11Daily1,30831,31251,30281,3036-702 
82022-03-10Daily1,31751,31951,30811,3084528 
92022-03-09Daily1,30991,31901,30881,3187452 
102022-03-08Daily1,31031,31451,30821,3100-998 
112022-03-07Daily1,32211,32431,31021,3103-1092 
122022-03-04Daily1,33441,33521,32021,3231-664 
132022-03-03Daily1,34041,34181,33181,33491117 
142022-03-02Daily1,33181,34071,32721,3405-3115 
152022-03-01Daily1,34171,34381,33021,332464 
162022-02-28Daily1,33091,34321,33091,3420-7-2 
172022-02-25Daily1,33731,34391,33671,3409-1110 
182022-02-24Daily1,35411,35491,32731,3377-7129 
192022-02-23Daily1,35741,36211,35361,3547161 
202022-02-22Daily1,36001,36051,35381,3586-3430 
212022-02-21Daily1,35861,36391,35841,3600-4-1 
222022-02-18Daily1,36141,36431,35731,3595528 
232022-02-17Daily1,35821,36381,35561,3614372 
242022-02-16Daily1,35341,36011,35261,35793446 
252022-02-15Daily1,35191,35671,34871,3540-55 
262022-02-14Daily1,35511,35721,34951,3533-3824 
272022-02-11Daily1,35531,36101,35141,3560-348 
282022-02-10Daily1,35341,36441,35231,35611,3644286117-73,1%20-22
292022-02-09Daily1,35381,35891,35271,3534192 
302022-02-08Daily1,35351,35641,35081,3548171 
312022-02-07Daily1,35331,35511,34911,3536-1440 
322022-02-04Daily1,35961,36151,35051,3527-33-1 
332022-02-03Daily1,35741,36281,35381,3599238 
342022-02-02Daily1,35161,35871,35151,3576872 
352022-02-01Daily1,34431,35281,34281,35244110 
362022-01-31Daily1,33931,34601,33871,344522-1 
372022-01-28Daily1,33791,34331,33651,3395719 
382022-01-27Daily1,34611,34681,33581,33811,3358-391-167-66,5%1-32
392022-01-26Daily1,34931,35251,34451,3465611 
402022-01-25Daily1,34851,35191,34361,3500-47-1 
412022-01-24Daily1,35511,35651,34411,3490-37-1 
422022-01-21Daily1,35991,36021,35461,3553-601 
432022-01-20Daily1,36101,36621,35871,3598134 
442022-01-19Daily1,35921,36491,35871,3612-1311 
452022-01-18Daily1,36421,36621,35731,3598-2819 
462022-01-17Daily1,36741,36901,36371,3645-53#NUM! 
472022-01-14Daily1,37071,37431,36531,3683-6#NUM! 
482022-01-13Daily1,36961,37491,36961,37021,3749588128-87,3%#NUM!-42
492022-01-12Daily1,36331,37141,36211,370059#NUM! 
502022-01-11Daily1,35761,36361,35621,363429#NUM! 
512022-01-10Daily1,35801,36041,35321,35755#NUM! 
522022-01-07Daily1,35271,35981,35271,359237#NUM! 
532022-01-06Daily1,35511,35591,34901,3535-32#NUM! 
Time2Swings
Cell Formulas
RangeFormula
K2:K53K2=NETWORKDAYS(LARGE(IF(G1:G1000<>"",A1:A1000,""),ROW(A2)),LARGE(IF(G1:G1000<>"",A2:A1000,""),ROW(A1)))
L2:L53L2=IF(G2="","",IFERROR(NETWORKDAYS(AGGREGATE(14,6,A3:A$1000/(G3:G$1000<>""),1),A2),""))
Press CTRL+SHIFT+ENTER to enter array formulas.
 
Upvote 0
My formula was intended to extract the list of the results in a separate column (for example in M2:M10), not in column L
Fluff understood better than me your request, for sure he will comment the strange behaviour you reported.

Bye
 
Upvote 0
I guess i see the issue here.

I was having a problem;

There were 2 different timeframes, Daily and Weekly. I removed Weekly because these were having weekly dates (2022-3-6, 2022-3-6, etc) instead of days.
Separately: Daily sheet, and Weekly sheet, then it worked out Fluff.

Is there a way to make it work with the weekly timeframe, like if weekly...if daily?

Thanks anyways.
 
Upvote 0
How about
Excel Formula:
=IF(G2="","",IFERROR(NETWORKDAYS(AGGREGATE(14,6,A3:A$1000/(G3:G$1000<>"")/(B3:B$1000=B2),1),A2),""))
 
Upvote 0
Solution
Yes! I get the right results now.

Thank you so so much!

Have a great week.
 
Upvote 0
You're welcome & thanks for the feedback.
 
Upvote 0

Forum statistics

Threads
1,223,237
Messages
6,170,928
Members
452,366
Latest member
TePunaBloke

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