Reduce number of cells in Excel

后端 未结 3 1146
礼貌的吻别
礼貌的吻别 2021-01-22 23:49

I have a spreadsheet managing a list of groups in time slots. Imagine the below are cells:

0830-0845, Bob Hoskins, Jack Table, Phil Cup
0845-0900, Bob Hoskins, J         


        
3条回答
  •  囚心锁ツ
    2021-01-23 00:10

    Partial solution that is fairly easy to maintain using Pivot tables:

    1. Get start time column:
      Add new column with formula: =VALUE(MID(RC[-4],1,4))
      Where RC[-4] is your original time range.

    2. Get end time column:
      Add new column with formula: =VALUE(MID(RC[-5],6,10))
      Where RC[-5] is your original time range.

    3. Concatenated names column:
      =CONCATENATE(RC[-5],RC[-4],RC[-3])
      Where RC[-5], RC[-4], RC[-3] are the cells with the name values.
      This is for grouping in Pivot Table.
      You should get something like this: New extended table
      Note headers are important!

    4. Insert a pivot table with your new extended table into a new worksheet:
      Set row labels to name concatenation column.
      Add start time column as value, with value field setting as min Add end time column as value, with value field setting as max
      Set the number format of min of start and max of end as '0000' so it displays time correctly Pivot table settings

    In terms of maintainability:

    • Set a dynamic source range for your Pivot table (fairly easy to do).
    • Update your extended columns by dragging formula or using hotkeys: ctrl+, ctrl+d to extend instead.
    • Write a very simple macro to extend/update the extended columns for you.

    Simplifications/Assumptions:

    • Ordering of names is significant i.e. do not treat collection of names as a set

    With excel, my advice is always to leverage existing tools as much as possible rather than use overly complicated cell formulas which can be hard to debug and possibly less efficient.

    Let me know if this output is useful enough otherwise I'll see what else can be done.

提交回复
热议问题