Assigning day number to travel data

mtnbaik

New Member
Joined
Aug 15, 2016
Messages
7
I am looking for assistance with a terribly formatted data set I was given with travel data. I need to assign number to the legs (days) of each trip, but am stumped on a formula/function that can help me. I've attached a sample set where I've manually entered the day numbers in the screenshot below to show you what I'm looking to do. Basically, what i am looking to do is assign 1 to the first day of trip, 2 to the second day of trip, 3 to third day, and so on. So if there was 3 parts to the day 1 travel, I need it to display all three as day 1. Thank you for any help!

open

Cell Formulas
RangeFormula
A1Day
A21
A32
A51
A62
A81
A92
A111
A121
A131
A142
A152
A171
A181
A192
A202
B1Segment Departure Date/Time
B242646.37916666
B342651.53819444
B4Segment Departure Date/Time
B542646.37916666
B642651.53819444
B7Segment Departure Date/Time
B842659.39097222
B942664.42847222
B10Segment Departure Date/Time
B1142681.37152777
B1242681.5625
B1342681.56944444
B1442685.625
B1542685.76805555
B16Segment Departure Date/Time
B1742681.34722222
B1842681.35069444
B1942685.48611111
B2042685.50625
B21Segment Departure Date/Time
B2242681.51041666
B2342685.5
B24Segment Departure Date/Time
B2542681.29166666
B2642685.52777777
B2742685.53194444
B2842685.67708333
B29Segment Departure Date/Time
B3042649.50833333
B3142649.62083333
B3242652.59097222
B3342652.81944444
 
Last edited:

Excel Facts

Show numbers in thousands?
Use a custom number format of #,##0,K. Each comma after the final 0 will divide the displayed number by another thousand
Re: Help assigning day number to travel data

This isn't particularly elegant, but should work, assuming your dates / times are all stored as Excel dates / times (i.e. numeric values) and NOT as text strings.

Put this formula in cell A2, and copy down.

=IF(LEFT(B1,7)="Segment",1,IF(ROUNDDOWN(B2,0)=ROUNDDOWN(B1,0),A1,A1+1))

If your dates / times ARE all stored as text strings, a similar approach can work but you'll need to tweak it a bit.
 
Upvote 0

Forum statistics

Threads
1,223,228
Messages
6,170,874
Members
452,363
Latest member
merico17

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