make template that reads data from table, moving down 1 row at a time, but the data is placed on 6 rows.

Gazz292

New Member
Joined
Mar 3, 2023
Messages
14
Office Version
  1. 365
Platform
  1. Windows
I'm trying to figure out a way to make a sort of template that i can insert into a sheet many times, to make a timetable for a game i'm playing, and each time i insert this 'template' it copies data from the next row down from the table,

all the data is in 2 tables, one for 'station data' the other for 'speed data', each row of the table has all the data needed for a single entry in the 'human readable sheet' but the 'template' thing needs to have at least 6 rows,
So at the moment when i try to copy and paste the timetable entry once i've set up the cell references to the tables cells, excel pulls the data from the table 6 rows down instead of one, thus it displays the wrong entry.

Below is part of my data sheet.

1679095121087.png

And below is the sheet where i make the data into a timetable, the yellow highlighter is to distinguish the 2 separate entries:

1679096012073.png


There are 2 entries on the above sheet, eventually there will be upto 50.
Each entry is 6 rows tall, but that may change occasionally as some entries that need more room, but i'd do that after the timetable is populated.

For the first entry i manually set it to pull the data from row 2 of the table,

And on the second entry i have typed the names of the columns in the tables that data is supposed to come from, so the second entry should be pulling it's data from row 3 of the table, and the next entry would pull the data from row 4 of the table and so on.

Is it possibly to make a tepmlate type thing that i can simply insert as needed, tell it the table row to read from, and it gets the correct data from the columns?
 

Excel Facts

Do you hate GETPIVOTDATA?
Prevent GETPIVOTDATA. Select inside a PivotTable. In the Analyze tab of the ribbon, open the dropown next to Options and turn it off
would you be kind enough to help the forum help you and use the xl2bb add in (Link below) to post a mini workbook of the three items?
If that is not possible can you just paste as a table? Also your formatting in the 3rd item makes it really hard to understand what is being mapped where.
 
Upvote 0
i've only just loaded the factory image to my laptop after someone hacked in and started emptying my bank account via google pay (which i never even set up, but apparently it will get the money from any payment method it finds, i.e. paypal etc)
So i'd rather not run external tools on excel right now.

I'll see if i can explain it better,

ignore the speed data part bit, that's from a separate table and i'll tackle that later,
I want to make a template which is a load of cells and borders merged a certain way to mimic a real Polish train driver's timetable, and i would like the cells in each new template i add populate themselves from the next row down of the table.

So here's part of the table with the station entries, it's one station entry per row (and goes on for 60 rows):

1679154730468.png


And the timetable part (which i save as PDF files when it's fully populated)
I've put 3 entries on the timetable below by copying and pasting the top one, the top one has cell references to the tables row 2, hence it's filled in the correct data for that entry,
The 2 entries below i've simply cleared the data and put text in the cells to show where on the table they should get their data from:

1679154260878.png


Each new 'template' entry needs to pull data from the relevant columns of the table, but only drop down to the next row once, not 6 or 7 times as it does now.

Below is what happens if i copy and paste the top entry and leave it as it's filled itself in... the 2nd entry should be pulling data from row 3 "Warszawa Grochów R5".
But it is actually pulling data from row 8, which is the "Warszawa Zach. R19" entry, this i believe is due to the timetable entry being made up of 6 rows each time (and the actual data starts at row 2, as row 1 is the table headers)

1679154837599.png


So i'm wondering if i can make some sort of template that when i add it to the timetable sheet i simply tell it the table row number, and it gets the correct data from that row. then it auto advances to the next row each time i add it below the last 'template'

This is so that i can make timetables for different lines simply by swapping out the data in the table, and re; adding the number of timetable entries as appropriate (some services have 60 entries, some have only 5)
 
Upvote 0
i've only just loaded the factory image to my laptop after someone hacked in and started emptying my bank account via google pay (which i never even set up, but apparently it will get the money from any payment method it finds, i.e. paypal etc)
So i'd rather not run external tools on excel right now.

I'll see if i can explain it better,

ignore the speed data part bit, that's from a separate table and i'll tackle that later,
I want to make a template which is a load of cells and borders merged a certain way to mimic a real Polish train driver's timetable, and i would like the cells in each new template i add populate themselves from the next row down of the table.

So here's part of the table with the station entries, it's one station entry per row (and goes on for 60 rows):

View attachment 87791

And the timetable part (which i save as PDF files when it's fully populated)
I've put 3 entries on the timetable below by copying and pasting the top one, the top one has cell references to the tables row 2, hence it's filled in the correct data for that entry,
The 2 entries below i've simply cleared the data and put text in the cells to show where on the table they should get their data from:

View attachment 87790

Each new 'template' entry needs to pull data from the relevant columns of the table, but only drop down to the next row once, not 6 or 7 times as it does now.

Below is what happens if i copy and paste the top entry and leave it as it's filled itself in... the 2nd entry should be pulling data from row 3 "Warszawa Grochów R5".
But it is actually pulling data from row 8, which is the "Warszawa Zach. R19" entry, this i believe is due to the timetable entry being made up of 6 rows each time (and the actual data starts at row 2, as row 1 is the table headers)

View attachment 87792

So i'm wondering if i can make some sort of template that when i add it to the timetable sheet i simply tell it the table row number, and it gets the correct data from that row. then it auto advances to the next row each time i add it below the last 'template'

This is so that i can make timetables for different lines simply by swapping out the data in the table, and re; adding the number of timetable entries as appropriate (some services have 60 entries, some have only 5)
if you can't do the add in. then post your data as a table. You're asking the forum to do a LOT of work to recreate your scenario.
 
Upvote 0
Okay. This was quite an exercise. But I think I have it figured out. The INT and MOD Calculations need to be adjusted for your starting cell in the first cell of the box. Then copy over and then down.

I strongly recommend no merging of cells. If you want no gridlines, just say no gridlines from your view tab.
mr excel questions 15.xlsm
ABCDEFGHIJKLMNO
1StationStopArrival
2Radio
3StationStopArrivalDepartRadioStatInfoMileageMileageStatInfoDepart
4Warsza Gro;zd;ph00:34:0000:37:00R2,R1,R6R307,RT,H,SS4.254Warsza Gro;zd;ph 0.023611
5  R2,R1,R6 
64.254 R307,RT,H,SS0.025694
7
Sheet16
Cell Formulas
RangeFormula
K4:N6K4=IFERROR(INDEX($B$4:$H$10,(1+INT((ROW(I4)-4)/3)),CHOOSE((1+MOD((ROW(I4)-4),3)), CHOOSE((1+MOD(COLUMN(K4)-11,4)),1,2,"",3), CHOOSE((1+MOD(COLUMN(K4)-11,4)),"","",5,24), CHOOSE((1+MOD(COLUMN(K4)-11,4)),7,"",6,4))),"")
 
Last edited:
Upvote 0
Solution
The above starts in cell K4, so the INT and MOD formulas are trying to get the numerator to be zero. So, to get the Row to zero for cell K4 you minus 4, to get the column to zero for cell K4 you - 11.

Also, I did not bring the time formats over for column N. You can correct that.
 
Upvote 0
i'm sorry, i only started using excel a month ago.

I've tried to make things as tables, showing basically what i need... some way of formatting where data is pulled from a table, it's not going into another table but a series of cells that have been merged and had borders added to some to make it all look like a real timetable, probably something excel isn't really made for.


So, the data table:
ABCDEFG
A2B2C2D2E2F2G2
A3B3C3D3E3F3G3
A4B4C4D4E4F4G4
A5B5C5D5E5F5G5

And the cells if they were a table... the output table?:
A1 & B1F1
E1
C1D1G1

And each time another 'output table' is added below the existing one, it need to pull the data from the next row on the data table, so here it would be from row 2, then row 3 and so on.
but at the moment it pulls the data from the 7th row down, as each 'output table' is 6 rows tall.

But the output has to look like this (gridlines shown to make the data entry bits stand out) (showing the table references for 3 entries... and then i'll need to figure out to left hand side which is data from another table, but a similar thing, each entry pulls data from the next row down, not 6+ rows down as i get when i copy and paste and let excel update the cell references)
 

Attachments

  • 1679172433550.png
    1679172433550.png
    18.2 KB · Views: 6
Upvote 0
OK. if you cannot get the formulas to work just tell me what cell has the first station name, and what cell you want the output to begin.
 
Upvote 0
Here it is with your sample data:


mr excel questions 15.xlsm
BCDEFGHIJKLMN
1StationStopArrival
2Radio
3StationStopArrivalDepartRadioStatInfoMileageMileageStatInfoDepart
4AB01:4903:59EF6.02AB 01:49:00
5A2B209:2810:25E2F23.768  E 
6A3B320:2120:31E3F33.1436.02 F03:59:00
7A4B418:5019:10E4F47.713A2B2 09:28:00
8A5B519:0621:36E5F57.643  E2 
93.768 F210:25:00
10A3B3 20:21:00
11  E3 
123.143 F320:31:00
13A4B4 18:50:00
14  E4 
157.713 F419:10:00
16A5B5 19:06:00
17  E5 
187.643 F521:36:00
Sheet16
Cell Formulas
RangeFormula
K4:N18K4=IFERROR( INDEX($B$4:$H$8, (1+INT((ROW(I4)-4)/3)), CHOOSE((1+MOD((ROW(I4)-4),3)), CHOOSE((1+MOD(COLUMN(K4)-11,4)),1,2,"",3), CHOOSE((1+MOD(COLUMN(K4)-11,4)),"","",5,24), CHOOSE((1+MOD(COLUMN(K4)-11,4)),7,"",6,4))), "")
 
Last edited:
Upvote 0

Forum statistics

Threads
1,223,911
Messages
6,175,324
Members
452,635
Latest member
laura12345

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