Fill spreadsheet table with list of names - excel

I need to fill an empty table (from an excel spreadsheet) with a list of values from a list of 13 values (names I have written in a different sheet) always in the same order. For example
Spreadsheet
Is there any way to do it without using a Macro? If there is no other way, then a Macro would be OK. I tried many things for weeks and I cannot figure it out :(
Thank you very much!

You can use this formula in the range C2:G9:
=Index( Sheet2!$A:$A ,Mod(Row()*5+Column()-13,CountA( Sheet2!$A:$A ))+1)
just replace Sheet2!$A:$A with the column or range where the names are.
( -13 is short for -ROW(C2)*5+COLUMN(C2) where C2 is the first cell where the names will be )

Okay, so it's a bit convoluted but I'll pull it into parts for now:
Add a new sheet:
in Column A put the list of names, make sure that cell A1 has heading of NAMES
in B2 put:
=Counta(A:A)
In cell C2 put 2
In Cell D2 put =IF(C2+1>$B$2,1,C2+1) - fill this across to G2
In Cell C3 put =IF(G2+1>$B$2,1,G2+1)
Then Fill this down as far as needed.
Then in Cell I2 put =HLOOKUP($A$1,$A:$A,C2,FALSE)
You can see here why we need the "header" row in A1
Fill this down as far as needed.
Example of how it looks with outputs:
Example where you can see the formula:
Now you can replace names, Add new names to the List of names etc, and it will keep the order and pattern.
I thought about putting all the formula into one cell, but for clarity have left them separate.

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)

How can I get Excel to generate columns dynamically, according to the values in a different column?

In Excel 2016, I have a "Brands" column, each of its rows containing a string. The set of possible string values is limited, and they may appear more than once.
There is related data in another column, "Models". Each model value is always different.
How can I get Excel to generate a column for each existing brand and populate it with the corresponding Models in an automatic way?
My problem is that I can't do it manually because for each analysis, the amount of Brands is different and I don't know it beforehand.
This would be the input:
And this is the expected output:
Any ideas?
Thank you in advance!
Try using an array formula. First, put the distinct brand values on row 1, starting in column D. You can use column C if you want, but I like to have an empty column between the data and the desired results.
D1 = Apple, E1 = Nokia, F1 = Samsung, G1 = Xiaomi
Then, just below Apple in cell D2, paste this formula:
=IFERROR(INDEX($B$2:$B$9999, SMALL(IF(D$1=$A$2:$A$9999, ROW($A$2:$A$9999)-ROW($A$2)+1), ROW(1:1))),"")
If you have more than 9999 rows, then adjust as needed in the formula.
With the cursor still in the formula, make it an array by simultaneously pressing CTRL-SHIFT-ENTER.
Copy the formula across to cells E2, F2 and G2. You may need to repeat the array trick (CTRL-SHIFT-ENTER) for each of those again if things look wrong. So, your excel will look like this:
Now, drag the formulas down as far as you need. The iferror part of the formula will ensure that cells look clean if no more models are found.
---EDIT AFTER RECENT COMMENT---
I cannot determine how to automatically pick distinct values from column A and automatically convert them to a row. It's easy to keep it in a column, but the transpose to row is troubling.
At any rate, here's the ugly update. Cell D1 would simply state "Brands". In cell D2, make this an array formula (CTRL-SHIFT-ENTER).
=IFERROR(INDEX($A$2:$A$9, MATCH(0, COUNTIF($D$1:D1, $A$2:$A$9), 0)), "")
So, row 2 will be your brands. Drag the formula across, repeat the array trick.
Now, in cell E1, type formula =D2. Drag across.
Place the formula suggestion from the original answer, starting in row 3. End result looks like this below. It should be "automated" now, but it's not appealing. Minor edits will help (making row 1 nearly invisible, for example).

Trying to import cell data based on cell drop down

I'm trying to re-do a spreadsheet.. Without having to put an =if into every cell where the data would be variable depending on the selection of a drop down (Which is how it is set currently :( )
On the main sheet.. Cell J1 i have a dropdown selection.. And im looking for the cells in
A1-F1 to be populated with the information on the data sheet.. Based on the selection either 1 or 2 in this example but i cant figure out how to do this
Any help would be appreciated
This is what VLOOKUP functions are for. VLOOKUP functions search for a key in the first column of a range, and matches the selected row on it.
You can just put =J1 into your A1 cell, and on your B1 cell you can search for A1 as =VLOOKUP($A1,Data!$A$1:$F$2,2,FALSE). This formula can be read like this:
"Please, search for the value that it's in $A1 in table Data!$A$1:$F$2.When you got it, get me the column 2. Ah, by the way, if you asked me if the key column is made of sorted numbers, so if you can't find it, you can extrapolate linearly, I'd answer FALSE, got it? Thanks a bunch!"
So, in your C1 cell you'd ask for the column 3, and so on. Of course, if you'd like to just create a single formula, you can insert a row over your row 1, and put the column references over the cells, as this:
In this case, my formula on B1 is =VLOOKUP($A2,Data!$A$1:$F$2,B1,FALSE) - which can be dragged to C1:F1. Of course you can later hide the row 1 from your user.
Hope that helps.

I have a column in Excel which gets data from another column, in another spreadsheet. How do I add an empty row after every cell?

As the title suggests, I have a column in my first worksheet which gets its data from another column, in a second spreadsheet.
I have linked them using ='Data'!B1
Of course, if I drag the handle down, I get all the remaining data from the linked column, but I would like to have an empty row after each cell.
Like so: B1 has data, B2 is blank, B3 has data, B4 is blank, etc.
If some kind person out there could help me out, I would appreciate it very much. I have tried macros and looked this up in forums but can't seem to make this work with Data --> Sort.
Thank you! :)
Given what you're asking for, the way I would do it would be using the Offset or Indirect function so I can control which cells to pull in from the other sheet.
Given your example, in Sheet1, I would have:
B1: =OFFSET(Sheet2!$B$1,(ROW(B1)-1)/2,0)
B2: <blank>
B3: =OFFSET(Sheet2!$B$1,(ROW(B3)-1)/2,0)
B4: <blank>
You can drag this down and it will give you alternating formula / blanks and pull the consecutive row from the other sheet.
As a quick explation, the function will always look at cell B1 in your second sheet and offset it by (Row()-1)/2 rows... So, in row 1, it would offset it by (1-1)/2 = 0 rows, in row 3, it would offset it by (3-1)/2 = 1 rows, etc.
Hope this makes sense and does the trick!!

How to reference value in cell to the left within a formula

I have 2 sheets in my spreadsheet. Sheet2 pulls information from Sheet1. In sheet2, there are 2 columns. Column A has company names. Column B has a formula which searches for the company name of that row within sheet1, and sums the values from that row in sheet1.
I have been able to achieve this with the following formula.
=SUMPRODUCT((Sheet1!B:B=A1)*(Sheet1!F:F))
This works fine, however I have to manually type "A1" into the formula. For the other rows, I would have to write B1, C1, D1 etc.
I have searched for how to reference the cell to the left, and I found this formula...
=OFFSET(INDIRECT(ADDRESS(ROW(), COLUMN())), 0, -1)
This seems to work as a standalone formula in a cell, but I cannot figure out how to incorporate this into the SUMPRODUCT formula. Anything I try gives errors. I need something like this.
=SUMPRODUCT((Sheet1!B:B=(=OFFSET(INDIRECT(ADDRESS(ROW(), COLUMN())), 0, -1)))*(Sheet1!F:F))
As per pnuts' suggestion to make it an answer:
The answer is just to drag the formula around. Just make sure to fix (either use F4 or add dollar signs) your range if it is not an entire column or an entire row

Resources