I'm trying to populate a new table in a new worksheet with data from an existing table in a different worksheet. I need to reference the column header name because the positions of the columns may change.
I currently have this:
=TableName[#[ColumnHeaderName]]
This works but the problem is when I try to sort any of the columns in the new table, it doesn't sort because it is referencing the same row in the existing table. I'm guessing I need to reference the column name and row number, but when I try "=TableName[#[ColumnHeaderName]] 2:2" it displays #VALUE!.
Any help would be greatly appreciated.
It seems that you are working with excel tables (i.e. ListObjects).
The formula:
=TableName[#[ColumnHeaderName]]
refers to the
- Table: TableName
- Column: ColumnHeaderName
- Row: Row of the cell where the formula is entered from the Worksheet where the Table is located.
Therefore if the TableName header is located at row 6 of Sheet1 and the formula is entered in row 8 of Sheet2 it will return the value in column ColumnHeaderName, row 8 of Sheet1 which is the row 2 of the Table.Body (e.i. DataBodyRange)
To return the first value in column ColumnHeaderName of the TableName use this formula:
=INDEX(TableName[ColumnHeaderName],1)
TableName[#[ColumnHeaderName]] refers to the same row of the table and
TableName[ColumnHeaderName] refers to the entire column.
Also, any of the above formulas exclude the header of the Table.
To refer to the header use:
=TableName[[#Headers],[ColumnHeaderName]]
if you want to refer the entire header use:
=TableName[#Headers]
Since you are entering the formula in another excel table, lets named it Table2, in order to have the row number dynamically updated enter this formula:
=INDEX(TableName[ColumnHeaderName],ROW()-ROW(Table2[#Headers]))
Related
I'm looking for a formula that would allow me to extract rows from a table where the value in the first column is equal to a reference?
See the table below:
If the value in the first column is equal to 13:00:00, as it is on the right of the pic, extract the relevant row onto a new table. I have attached the spreadsheet to play with.
https://www.mediafire.com/file/eaz7no3263vl3sd/Table.xlsx/file
Just FILTER the range against the reference value:
https://support.microsoft.com/en-us/office/filter-function-f4f7cb66-82eb-4767-8f7c-4877ad80c759
Im doing a check for the value in C2 in a table (call it M1table), using this part of the formula:
(C$2=M1table)
Whole formula:
=RIGHT(INDEX(M1table,(SUMPRODUCT((C$2=M1table)*ROW(M1table))-ROW(M1table)),20),1)
How do I specify columns instead of checking the whole table? Unfortunately I don't have named columns, is there a way to do it with column number (look for value of C2 in 2nd to 8th column)? If using column names is the only way, I can name them.
Thank you
If M1table is a real Excel table, then the column header is the name and you can reference like M1table[colName]
If M1table is just a range, and not a real table, then you can use the INDEX function to reference a single column. eg: for the 2nd column in the table:
C$2=INDEX(M1table,0,colNumber)
For columns 2-8 you could use:
=$C2=INDEX(M1table,,2):INDEX(M1table,,8)
I have 2 tables on the same sheet. The first table "Rank" has values in column 1 (or column A) and rows 2 through 8.
I want to use the rows in the Rank table as the header row in the second table "DataTable".
I have tried using =INDEX(A2:E8,2,1) as well as structured references like
=Count(Indirect("Rank["$A$2"]"))
and
=Count(Indirect(Rank[[Attribute]],[A2])).
I either get an error that the formula has a mistake OR I get a value of 0 in the cell with the formula gone.
How do I get the text from the Rank table in cell A2 to be the header in column E of the DataTable?
Column() will return the number of the column in your new table. You can use this to relate to the row in the first table.
Something along the lines of =INDIRECT("RankSheet!A"&COLUMN()-3)
The "-3" assumes that this is going in cell E1 of the new sheet, but that you want cell A2 in the Rank table, so the formula evaluation looks like:
INDIRECT("RankSheet!A" & 5-3)
INDIRECT("RankSheet!A" & 2)
INDIRECT("RankSheet!A2")
Then, as you drag this across, the increasing COLUMN reference will refer to an increasing row reference on the RANK table.
I use excel 2007
i made a table with few columns but too many rows. Each row contains some data and simple formulas.Now I want to duplicate a specific row based on current date [TODAY()] at top of the sheet.I mean whenever I open the file,the right row according to computer date,be shown directly at somewhere else instead of looking through all rows to find it.
thanks
above your table. add an empty row.
First column add =TODAY() // This will show todays date in the column and can be used in your other formulas. We will assume the cell is A1
Second Column add = VLOOKUP($A$1,A2:D8,2,FALSE) A1 being the date, A2:D8 being the table range (A2 top left cell, D8 bottom right cell), 2 is the second column of your table range, false returns the value in the second column as longs as the date (A1) matches the date in the first column on your table range.
Copy the formaula across the columns, changing the lookup column in the formula. ie. Third column VLOOKUP($A$1,A2:D8,3,FALSE)
Glad to help.
I have a data table with 8 columns and i want to know if anyone can help me come up with a formula to get the name in the first column if i enter a value into the columns (3,4,5,6,7,8).
I want the name from the first column to appear in another table on another sheet where only names appear where data is in the columns (3,4,5,6,7 & 8)
Try this:
=IF(OR(Sheet1!C2<>"";Sheet1!D2<>"";Sheet1!E2<>"";Sheet1!F2<>"";Sheet1!G2<>"";Sheet1!H2<>"");Sheet1!A2;"")
You can use C1 = 1 .... if you prefer.
And C1,D1,E1... have to be replaced with your columns.
Also Sheet1 have to replaced with your sheet name
I would use a Pivot tables.
First create a new column in the existing table:
If you only having positive values then it is:
=sum(C2:H2)
If you have zero and negative values as well it would be like this:
=IF(COUNTBLANK(C2:H2)=6;0;1)
Then make a pivot table with the "TO/TA name" in the Row Labels and the new column in Report filter - where you then removes the "0".