Datediff function in VBA can be used to calculate difference between two dates. This tutorial explains, how to find difference in two dates in terms of years, months, days, quarters and weeks etc. by using datedif formula in Excel VBA.
Informative, Yet there is a calculating error on the number of days. It should read 367 days not 397. Also months are 12 as you cannot change the month for the extra day.....
Can we create a function rather creating command command might use to certain range but for big data sets we need the function for each item days weeks month quarter fiscal year on individual cell
Thanks for this helpful video I would request you to please advise on using this code for bulk data in rows Example if I want to check diff in days or weeks for 500 rows
Just use a "For - Next" loop for this task, and include the varibale in the cell Sub TimeCalc() Dim B as int For B = 1 To 500 ''do this (Code here with variable Like "Sheets(3).Cells(B, 2).value") Next B end Sub
सर कृपया एक बात समझ मे नही आई। start date 03-08-2019 है और end date 04-08-2020 है इनमे 1 साल 2 दिन यानी 365+2=367 दिन और महीनों में 12 महीने का अंतर है जबकि रिजल्ट में 397 दिन , महीनों में 13 महीने बता रहा है । ऐसा क्यों है। कृपया इसको एक्सप्लेन जरूर करे। ताकि हम इस function को यूज़ करने में कही गलती न करे। रिप्लाई जरूर करें।
Thanks for your question. I can not say anything, without looking into you formula and your sheet. If you want, you can send me your sheet at EXCELDESTINATION@GMAIL.COM and will reply with my observation (solution).