Worksheet that summarizes travel schedule date/locations found on another worksheet?

alexcr

Board Regular
Joined
Oct 15, 2018
Messages
59
Office Version
  1. 365
Platform
  1. Windows
Let's say there's a worksheet with 31 columns, with the first row of this worksheet containing the dates for the month of August, i.e. 8/1-8/31, and the second row containing a travel location for each of those dates.

For example, let's say the columns for 8/1-8/8 contain "New York", the columns for 8/9-8/16 contain "London", the columns for 8/17-8/24 contain "New York" again, and the columns for 8/25-8/31 contain "Madrid".

What formulas would you use to create a second worksheet that summarizes each trip found in the first worksheet? Specifically, for the example illustrated above, the second worksheet would automatically generate four columns, i.e. one column for each trip, with the first row showing "8/1-8/8", "8/9-8/16", "8/17-8/24", "8/25-8/31" and the row beneath this showing "New York", "London", "New York", "Madrid".

The key thing is that this summary worksheet would need to automatically update, so if a fifth or sixth trip were added, additional columns would automatically appear to reflect this.

To add another layer of complexity to this, let's say that the first worksheet also contains a row, or perhaps multiple rows, with costs for each day at each location. How would you also show the sum of the costs for each trip in the summary worksheet?
 
Last edited:

Excel Facts

What is the last column in Excel?
Excel columns run from A to Z, AA to AZ, AAA to XFD. The last column is XFD.
Here is one approach. The beginning of the month for creating the daily calendar is a user input in A1. The user populates B5:AF8 with trip location and costs associated with each day. A helper row in B3:AF3 builds and index representing contiguous blocks of matching locations, which is used to create the summary table. You can hide this row or turn the text white to match the background color.

The summary table is shown on the same sheet for convenience. The first row is another helper row of all of the trip indexes in the source table where the "locations" are not blank. Then three formulas are used to create the date range for each trip, the location, and the total cost.
The source table...I'm not sure why XL2BB displays one formula here the way it does, but the formula in B3 and copied across to the right is:
Excel Formula:
=IF(A5=B5,MAX($A3:A3),N(A3)+1)
MrExcel_20220721.xlsx
ABCDEFGHIJKLMNOPQRSTUVWXYZAAABACADAE
18/1/2022
2
3Label111111223333333344555567888899
4Date8/18/28/38/48/58/68/78/88/98/108/118/128/138/148/158/168/178/188/198/208/218/228/238/248/258/268/278/288/298/30
5LocationNew YorkNew YorkNew YorkNew YorkNew YorkNew YorkLondonLondonLondonLondonLondonLondonLondonLondonNew YorkNew YorkNew YorkNew YorkChicagoNew YorkMadridMadridMadridMadrid
6Cost1264100151050
7Cost27352002261050
8Cost3321300375.51050
DailyTripLog
Cell Formulas
RangeFormula
B3:AE3C3=IF(B5=C5,MAX($A3:B3),N(B3)+1)
B4:AF4B4=SEQUENCE(,DAY(EOMONTH(A1,0)),A1)
Dynamic array formulas.

...and the summary table:
MrExcel_20220721.xlsx
AHAIAJAKALAMAN
3Label135678
4Dates8/1-8/68/9-8/168/19-8/228/23-8/238/24-8/248/25-8/28
5LocationNew YorkLondonNew YorkChicagoNew YorkMadrid
6Total Cost33.00600.008.0018.005.50180.00
DailyTripLog
Cell Formulas
RangeFormula
AI3:AN3AI3=UNIQUE(FILTER(B3:AF3,B5:AF5<>""),1)
AI4:AN4AI4=TEXTJOIN("-",,TEXT(XLOOKUP(AI3,$B$3:INDEX($B$3:$AF$3,COUNT($B4#)),$B4#,,0,1),"m/d"),TEXT(XLOOKUP(AI3,$B$3:INDEX($B$3:$AF$3,COUNT($B4#)),$B4#,,0,-1),"m/d"))
AI5:AN5AI5=INDEX($B$5:INDEX($B$5:$AF$5,COUNT($B4#)),MATCH(AI3,$B$3:INDEX($B$3:$AF$3,COUNT($B4#)),0))
AI6:AN6AI6=SUM(FILTER($B$6:$AF$8,$B$3:$AF$3=AI$3))
Dynamic array formulas.
 
Upvote 0
Solution
Thank you, @KRice! This got it done for me. I really appreciate it.

BTW, I hadn't even thought about the possibility of there being days without a location, so nice work capturing that case, too.
 
Upvote 0

Forum statistics

Threads
1,214,523
Messages
6,120,033
Members
448,940
Latest member
mdusw

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