Every n rows down select the next row from another sheet - excel

A list of names (Sheet "Name") which need to put on the following sheet in 5 (preferably variable number) row gaps.
A3 = Name!A1
A9 = Name!A2
A15 = Name!A3
A21 = Name!A4
I've tried using the ROW() in conjunction with IF/THEN/ELSE condition loop,checking for blank row, which fell short. More googling has lead me to the the offset() operand but that's accessing cells rather than writing in them.
I'm quite happy to use VBA active cell but the VB editor doesn't work properly on this machine so for the time being i'm trying to solve this task using EXCEL.

Ooption A:
Put this formula into A3,
=INDEX(Name!A:A, INT(ROW()/6)+1)
Copy to A9, A15 and A21.
Option B:
Put this formula into A3,
=IF(NOT(MOD(ROW()-3, 6)), INDEX(Name!A:A, INT(ROW()/6)+1), "")
Fill down to A21.

Alternatively, you can offset based on the number of rows you've already filled.
=OFFSET(Name!$A$1,counta(A$1:A2),0)
This will work as long as there is no content within other rows between A3,A9,A15,A21.
A little more dynamic would be to add a reference row in the Name tab that would allow you to do a VLOOKUP/MATCH/etc within the new tab. That is very handy when you want to make a variable number of rows in the new tab for each row in the other tab (for example, table 1 lists a quantity and you need a row for each quantity in the next tab--the lookup reference would be a cumulative sum of all of the quantities and you could lookup to that reference).

Related

How to create and copy a formula which takes data from every second column and adds it to another sheet in a row

I have a sheet ("Names") with data starting in B1 and continuing across the row with a named value in every second cell. (eg B1, D1, F1 etc).
I would like to use a formula to insert this in a second sheet ("List") as a series of rows. (Eg. B6, B7, B8 etc)
I have tried to add an OFFSET formula to the "List" sheet but can't copy this down the page.
I have tried:
=OFFSET('Names'!B$1,0,2)
However when I copy this formula down the column it continues to reference the same cell.
How do I get this to increment so I end up with a formula in each row of the "List" such as:
=OFFSET('Names'!B$1,0,2)
=OFFSET('Names'!B$1,0,4)
Which would return a list of names from the first sheet?
For example:
B1
D1
F1
etc
I would like it so if more rows are needed in the "List" to correlate to new columns in "Names", the formula can be copied down the row.
Any help is greatly appreciated
Since, i have shared the solution in comments, hence sharing it in answers as well, so that some one looking for a solution may find it useful in future,
• Formula used in cell B6
=OFFSET(Names!$B$1,0,(ROW(A6)*2)-12)

Reference named ranges in external workbook with formula criteria

Need Help on Named Ranges in Formulas:
I have a second workbook ('TEST.xlsx') as the destination, referencing worksheet-scoped named ranges (in 12 columns X 75 rows) in the source workbook ('FLOW.xlsx'). I want to create a formula that will match a look-up value (a date entered into cell C3 in TEST that will return the matching named range IF there are 2 or more blank cells in that matched named range/column and the remaining named ranges/columns in that set of 12 columns with 2+ blank cells. The 12 separate columns in the source workbook ('FLOW') are named by month, year and location (ex., "jan_2019_class.1","feb_2019_class.1", etc.), the worksheet columns being C, H, M, R, W, AB, AG, AL, AQ, AV, BA, and BF. The rows are 80-155. I've only been able to make a simple working COUNTBLANK formula in my TEST workbook, ex.:
=COUNTBLANK('[FLOW.xlsx]Class_1-Chart'!jan_2019_class.1)
But NOT for successive columns (with different named ranges and the columns are non-sequential); and I can't figure out the functioning formula to combine with this to get the count AND data returned by criteria as described above. Please, no VBA/macros.
Thank you in advance for the help!
'TEST.xlsx' Screen Shot-RVSD
FLOW.xlsx- sample screenshot
There are many approaches but I personally prefer the use of helper rows/columns/cells and named ranges.
In my demonstration I used two class attendant schedule in two different year from January to June as shown below (they are sitting in Column C to M in my example):
As shown above, I have added two helper rows on top of each schedule. The first helper row is used to find out if there is 2 or more vacancies in each month, if so returns TRUE. I have given the name check.2019.class.1 and check.2021.class.5 for each of them.
The second helper row is simply showing the range name of each month such as jan_2019_class.1, feb_2019_class.2 etc. I have given the name NameRng.2019.class.1 and NameRng.2021.class.5 for each of them.
On the TEST sheet I have the following set up:
where the look up value in cell C3 is actually returned by a formula so it can be "dynamically" changed by the user. Please note in the following formula I used a name ClassNo which is essentially the value from cell B3.
=B2&"_"&B1&"_class."&ClassNo
I have also named cell C3 as Start_MthYrClass which will be used in my following formula.
The formula for looking up the first available month in 2019 if the start month is jan_2019_class.1 is:
=INDEX(NameRng.2019.class.1,MATCH(1,(TRANSPOSE(ROW($1:$11))>=MATCH(Start_MthYrClass,NameRng.2019.class.1,0))*Check.2019.class.1,0))
Please note it is an array formula so you MUST press Ctrl+Shift+Enter upon finishing the formula in the formula bar otherwise they will not function correctly.
The logic is to first "filter" the range NameRng.2019.class.1 using this formula =TRANSPOSE(ROW($1:$11))>=MATCH(Start_MthYrClass,NameRng.2019.class.1,0), in which ROW($1:$11) represents {1;2;3;4;5;6;7;8;9;10;11} and TRANSPOSE will turn it into {1,2,3,4,5,6,7,8,9,10,11}. This range of numbers represents the column index in that specific range which is Column C to M (in your case it would be ROW($1:$56) as your data is in Column C to BF). Then I use MATCH to return the start column index of the look up month jan_2019_class.1, and it should return 1 as this month starts in the 1st place/column in the range NameRng.2019.class.1. So this is what I am actually comparing: {1,2,3,4,5,6,7,8,9,10,11}>=1, and it will return {TRUE,TRUE,TRUE,TRUE,TRUE,TRUE,TRUE,TRUE,TRUE,TRUE,TRUE}.
Then I multiply the above result with range Check.2019.class.1 which is essentially {FALSE,0,FALSE,0,TRUE,0,FALSE,0,TRUE,0,TRUE}. Then I will get {0,0,0,0,1,0,0,0,1,0,1}. FYI in Excel TRUE=1 and FALSE=0, so TRUE x FALSE = 0 while TRUE x TRUE = 1.
Lastly, I use MATCH to find out the position of the first 1 in the above result which is the 5th place/column, and then use INDEX to return the corresponding value from range NameRng.2019.class.1 which is mar_2019_class.1.
Here is a more universal formula which allows you enter it in the first cell C6 and drag it down to apply across board, if you have given names to the relevant cells and ranges in the same way as what I have demonstrated.
=IFERROR(INDEX(INDIRECT("NameRng."&B6&".class."&ClassNo),MATCH(1,(TRANSPOSE(ROW($1:$11))>=MATCH(Start_MthYrClass,INDIRECT("NameRng."&B6&".class."&ClassNo),0))*INDIRECT("Check."&B6&".class."&ClassNo),0)),"")
It is also an array formula so you MUST press Ctrl+Shift+Enter upon finishing the formula in the formula bar.
It is essentially the same formula as the first one but I have added IFERROR to return a blank cell if there is no match, and I used INDIRECT to refer to the named ranges dynamically based on the year and class number chosen.
Now, if I change the look up criteria to mar_2021_class.5, here is an updated result:
Let me know if you have any questions. Cheers :)

A table's column of same cell of different spreadsheets

I have different spreadsheets (on the following photo, from 1 to 25);
They have the same layout ( Photo here ).
I want to create a table with the E7 cell of each spreadsheet (A table of every "Total").
I tried this by extanding the formula...sounds good, doesn't work.
Put this in the first cell:
=INDIRECT("'" & ROW(1:1) & "'!E7")
And copy down.
If you put the following formula in the first 25 rows of your target sheet, it should do what you're trying to do:
=INDIRECT(ADDRESS(7,5,1,1,ROW()))
ADDRESS is formatting an address based on the parameters provided.
7 is the row
5 is the column (Column E)
1 says use an absolute reference $E$7
1 says us the A1 style address, not the R1C1 style.
ROW() says use the sheet having the same name as the row where the column appears. So, in row 1, it will use sheet named "1". In row 8, it will use the sheet named "8"
INDIRECT says to get the value from the provided address.
If you need to put the list in a set of rows farther down the sheet, just use ROW()-N where N is one less than the number of rows from the where your list starts. So, if your list of totals starts in row 3, use ROW()-2.

excel indirect cell reference and index rows

I want to reference the worksheet name and then transpose the totals in row 1 to a column in my summary worksheet.
I have found the following formula, which looks up a worksheet and takes the total, then I can paste this down to look up the row, essentially transposing row H1 to AG1 to column B on my summary worksheet.
=INDEX('201510'!$H$1:$AG$1,ROWS(B$1:B1))
Now I want to replace the direct ref to the worksheet tab to a lookup. So when I type the worksheet name in say row 2, it will give me the monthly totals.
This formula looks up the tab reference in B2 and displays the contents of H1. Where B2 has the worksheet name.
=INDIRECT("'"&$B$2&"'!$H1")
However when I copy this formula down the column, H1 does not change to H2. Furthermore, I need it to transpose vertically to I1.
How can I combine the two formulae?
Thanks,
Andy
You will need to combine the logic of an INDIRECT function with regular Excel referencing. Note that in your final formula, the "'!$H1" is text, meaning Excel doesn't try to compute it until it calculates the value of the cell. ie: it does not compute that what you are typing is a reference, just text.
So, assuming you continue to use the INDIRECT function, you will need to create the address of the final portion dynamically. There are many ways to do this. For example:
=INDIRECT("'"&$B$2&"'!H"&ROW()-1)
This version takes the string of the sheet name from B2, and then adds on the "'!H" as an additional string, and then takes the row as the current row number of the cell above the cell the formula is in. ie: if this formula is in D2, it will look up H1 on the other sheet. This method relies on your formula being in a consistent position within your sheet - if you insert a row above this one, it will change what ROW() calculates as, thus changing the formula.
Another method would be to reference H1 in a way that consistently points there, and also iterates into higher numbers as you drag down the formula. This method may be more useful for your purposes, as it also teaches another function:
=INDIRECT(ADDRESS(ROW(H1),COLUMN(H1),,1,$B$2))
Note that the ADDRESS function creates a string which shows the way a direct reference to a specific cell would. with the arguments I have above, it picks up the row number of H1 [iterating down, as there are no $ in front of the 1], the column number of H1 [iterating to the right, as there is no $ in front of the H], and the sheet name from $B$2.

How do I automatically update cells to match values from another sheet when one cell is changed using data validation?

I have a list of items on Sheet 1 with the names of each item in column A and then further information in the subsequent 5 columns.
On Sheet 2, in each of the cells of column A, I have set it so that I can pick any item from a dropdown list using data validation. I want the subsequent cells in the row to automatically assume the value of the respective cells in Sheet 1.
So if in Sheet 2, Cell A1 I select Item 3 (which is in Cell A3 on Sheet one), I want Cell B1 on Sheet 2 to have the same value as Cell B3 on Sheet 1.
I could get the result I wanted by using =IF($A3='Sheet1'!A3,'Sheet1'!B3,) and then adding each possible item but that seems really long winded and would require adding to the formula every time I added an item.
Any idea if there is a way of doing this? Sorry if my explanation is a bit confusing. My excel knowledge is not great!!
Thanks in advance
Use the Vlookup function
Next to your data validation cell, enter (assuming the first sheet called Sheet1):
=Vlookup(a1,Sheet1!a:f,2,0)
This will return the data that match for the 2nd column. For the 3rd use:
=Vlookup(a1,Sheet1!a:f,3,0)
And so on..

Resources