Copy ID Data based on converting date series into start date and end date

decent_boy

Board Regular
Joined
Dec 5, 2014
Messages
130
Office Version
  1. 2016
Platform
  1. Windows
Hi,
I have data sheet with Numbers in col A , ID in Col B and Dates in Col C I Just need a macro to copy each Number and convert its dated into start date and end date. I am attached here images of Data Sheet and Result Sheet.
 

Attachments

  • Data.JPG
    Data.JPG
    51.3 KB · Views: 10
  • Result.JPG
    Result.JPG
    37.9 KB · Views: 10
When working with dates, the country in which you are located comes into play. Since I am in Canada, the default date format is "m/d/yyyy". If you are in Europe, the default date format is "d/m/yyyy". In which country are you located?
 
Upvote 0

Excel Facts

Shade all formula cells
To shade all formula cells: Home, Find & Select, Formulas to select all formulas. Then apply a light fill color.
When working with dates, the country in which you are located comes into play. Since I am in Canada, the default date format is "m/d/yyyy". If you are in Europe, the default date format is "d/m/yyyy". In which country are you located?
I am in Pakistan and I am using format mm/dd/yyyy
 
Upvote 0
Do you want the start date and end date for each month based on each Number? Also, I noticed that the zeros in column A are now gone. Are you still using zeros before each Number?
 
Upvote 0
Do you want the start date and end date for each month based on each Number? Also, I noticed that the zeros in column A are now gone. Are you still using zeros before each Number?
Start date and end date for each date based on each Number as mentioned below updated result

Book8.xlsx
ABC
1NumbersIDDate
212345221/3/2022
312345221/3/2022
412345221/3/2022
512345221/3/2022
612345221/4/2022
712345221/6/2022
812345221/6/2022
912345221/7/2022
1012345224/2/2022
1112345224/2/2022
1212345224/2/2022
1312345224/3/2022
1412345224/3/2022
1512345224/4/2022
1623456221/3/2022
1723456221/3/2022
1823456221/3/2022
1923456221/4/2022
2023456221/4/2022
Data


Book8.xlsx
ABCDEFG
1NumberIDStart DateEnd DateDaysWorking Days
212345221/3/20224/4/20229264Incorrect
323456221/3/20221/4/202221
4
5
6
712345221/3/20221/4/202221Correct
812345221/6/20221/7/202222
912345224/2/20224/4/202230
Result
Cell Formulas
RangeFormula
E7:E9,E2:E3E2=DAYS(D2,C2)+1
F7:F9,F2:F3F2=NETWORKDAYS(C2,D2,Holidays!$B$2:$B$18)
 
Upvote 0
The start date and end date for 12345 are 01/03/2022 and 01/07/2022. Why do you have three different start dates and ends dates for 12345?
 
Upvote 0
The start date and end date for 12345 are 01/03/2022 and 01/07/2022. Why do you have three different start dates and ends dates for 12345?

Because there is a one more dealer ID column against each number which I eliminated here
Like number 12345 dealer ID 801, 12345 dealer ID 803
 
Upvote 0
I cannot make a suggestion if your data keeps changing. Post an exact copy of your data sheet.
 
Upvote 0
I cannot make a suggestion if your data keeps changing. Post an exact copy of your data sheet.
Please find below exact copy of data and required result

Book8.xlsx
ABCD
1NumbersIDDateDealer ID
212345221/3/2022801
312345221/3/2022803
412345221/3/2022890
512345221/3/2022876
612345221/4/2022852
712345221/6/2022902
812345221/6/2022802
912345221/7/2022875
1012345224/2/2022925
1112345224/2/2022921
1212345224/2/2022821
1312345224/3/2022854
1412345224/3/2022845
1512345224/4/2022980
1623456221/3/2022801
1723456221/3/2022803
1823456221/3/2022890
1923456221/4/2022876
2023456221/4/2022852
Data


Book8.xlsx
ABCDEF
1NumberIDStart DateEnd DateDaysWorking Days
212345221/3/20221/4/202221
312345221/6/20221/7/202222
412345224/2/20224/4/202230
523456221/3/20221/4/202221
Required Result
Cell Formulas
RangeFormula
E2:E5E2=DAYS(D2,C2)+1
F2:F5F2=NETWORKDAYS(C2,D2,Holidays!$B$2:$B$18)
 
Upvote 0
Like number 12345 dealer ID 801, 12345 dealer ID 803
I don't see either ID in your data sheet or result sheet. Again, I ask: Why do you have three different start dates and ends dates for 12345? I have spent some time trying to help you. If you cannot post data that reflects all possible variations of Number and ID, then perhaps someone else on the Forum will be able to help you.
 
Upvote 0

Forum statistics

Threads
1,215,583
Messages
6,125,661
Members
449,247
Latest member
wingedshoes

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