There are a lot of posts that relate, but I haven't found one quite like this. I am currently going through excel to help out in speeding up a process a little more.
The excel file has two spreadsheets. One is data the second is the summary.
On the data spreadsheet, I have the first column as names, and the next 7 columns with data values (Not all filled).
Name Data1 Data2 Data3 Country Address
VA 123 456 621 USA ExampleSt.
MD 123 France 123Street
DC 621 Korea 999Avenue
UseCol Value
Data2 456
Data3 621
Data1 000
My question is, I am given the value "621" (which can appear in multiple columns, but won't appear in ). I am given which set it should be in "data1, data2, data3...". How would I go about finding the name with that information? No VBA, only through excel.
I got stopped here with this code.
=INDEX(A1:D4,MATCH('621',*What do I put here*,0)
For that middle section, the reason why it is a problem is because I'm given which data column to use in another spreadsheet.
EDIT
So, I have followed what Tim Williams has said about using the offset. However, now I have a second column I am trying to get to. So the code that I used to get the Name is as follows
=IFERROR(INDEX(A2:A4,MATCH(B7,OFFSET(A2:A4,0,MATCH(A7,B1:D1,0)),0,1),"ERROR")
What changes do I have to make to the OFFSET portion to now look for the Country, or the Address cell? I believe the only part I need to change is that inner "MATCH" function. Should I do MATCH(A7,B1:D1,0)+3 to get to Country column? Thank you.
This worked for me as long as each number can only appear once per column.
EDIT: for getting the matching value from other columns you only need to adjust the first part of the formula.
The parameter you are missing is your lookup range in which you are trying to find the row that contains 621. Simply reference the desired column range, or create a named range and reference that.
WITH A GIVEN RANGE
I created a named range for the NAME column called "NAMERANGE".
I created a named range for the DATA1 column called "DATA1RANGE".
Using this formula I can retrieve the name if any of the row containing the given value in the given column range:
=INDEX(NAMERANGE,MATCH(621,DATA1RANGE,0))
Replace the value, and Data Range as needed.
WITH A DYNAMIC RANGE
If you need to dynamically choose the data range, you can use the INDIRECT() function to generate a reference to your desired lookup column. For example, in R1C1 style references, to get the DATA3 column, you would use the following formula:
=INDIRECT("C"&4&")
So in R1C1 style, given that you want to search in the 2nd data column (which is the third column of the spreadsheet), your formula could be:
=INDEX(NAMERANGE,MATCH(621,INDIRECT("C"&3),0))
Related
Little help needed here with excel dynamic named ranges.
I know how to make a dynamic named range that adjusts row height depending on the size of the range (no. rows with data in):
=OFFSET(Helper!$DJ$3,0,0,SUM(--(Helper!$DJ$3:$DJ$30<>"")))
However I find myself working with a large(ish) range of data across multiple columns - about 100 - and I REALLY want to avoid making 100 named ranges.
It must be possible to create a single named range that references the whole data set (DJ3:HE30) and the formula dynamically chooses which column to look at and (as before) chooses how many rows to return in that specific column.
The closest I've got is this:
=OFFSET(Helper!$DJ$3,0,0,SUM(--(Helper!$DJ$3:$DJ$30<>"")),SUM(--(Helper!$DJ$3:$HE$3<>"")))
But this just goes to the last column with data in (which makes sense really as it's doing the same thing with columns as it is with rows).
I'm assuming I need to tweak the starting point of the offset ref and somehow pass that column to the rest of the formula.
These named ranges are going to be used for drop-downs so the first drop-down will be the criteria that needs to be passed on to the second drop-down (that will utilize this new funky named range).
For example - if my first drop-down uses criteria 1,2,3 etc - my second drop-down would need to display results like this:
Option 1 = A,B,C
Option 2 = D,E,F
Option 3 = G,H,I
So the lists containing the letters in this example are all in individual columns, so the dynamic range needs to identify which column to use to pull the right list.
Also, with the number of columns I think I need to make this an INDEX rather than an OFFSET.
Can anyone point me in the right direction?
Thanks in advance, much appreciated!
It looks like I have managed to solve this one myself.
What I have done is create 2 named ranges as helper cells - Range_Start and Range_End. These ranges are single cells that contain an ADDRESS ref using MATCH to pick out the start and end of the column I need.
I then pass these named ranges to the formula I showed in my question but using INDIRECT to convert the cells to addresses:
=INDIRECT(Range_Start):INDEX(INDIRECT(Range_Start):INDIRECT(Range_End),COUNTA(INDIRECT(Range_Start):INDIRECT(Range_End)))
Works like a dream :-)
I'm trying to import all data from nth columns, starting from the 3rd row, from one worksheet ('Dataimport') to another ('Cleaned Data') in the same spreadsheet, but so far I have only managed to get a specific cell from every nth column:
=INDEX(Dataimport!$C$3:$HI$3;(ROWS($A$1:A1)*6)+1)
Right now I'm doing it manually, using =TRANSPOSE(IMPORTRANGE("1yyb1k0uAdN1XcLWBhNq4jA0eInnePRoUt9IbuXDmfEU";"Dataimport!I3:I300")) in every cell, so that the column data is imported horizontally (this is how it's supposed to look like):
The sheet with data looks like this. Here I want to retrieve data from every 7th column starting from column C:
Any idea how I do this?
Public link:
https://docs.google.com/spreadsheets/d/1hXFiSoduVjcZ6fbOcyp-BfI7m4So-01umLS0kBm-lVI/edit?usp=sharing
Proposed solution
Given your attempt =INDEX(Dataimport!$C$3:$HI$3;(ROWS($A$1:A1)*6)+1), I would suggest using the Google Sheets Formula OFFSET that allows specifying indexes as mathematical operations.
You will be able to specify the column offset with a simple mathematical operation in order to get the next needed indexes for the rows below.
Here is an example:
=TRANSPOSE(OFFSET(Dataimport!C$2:C$199;1;(ROW()-1)*6;199;1))
With this formula you can obtain the right column form the Dataimport Worksheet and then transpose it in order to fit it in a row.
Putting this formula in the Clean Data "D2" Cell will compute a column offset of 6 starting from the 3rd column ("C") considered in the OFFSET formula. Dragging down the formula will adjust the column offset index to the needed 7 columns range.
Reference
OFFSET
I think I have a solution.
I've build a spreadsheet with dummy data and then I made a formula that takes every nth column from the table.
Here is my solution:
https://docs.google.com/spreadsheets/d/1J6x4H_cNczRRo40Ri6Nwa-YnZOISpxZmG4-JZ7tA1kA/copy
First I make an ID column to both tables to let vlookup work
I use vlookup and arrayformula formula for this:
For grabbing multiple columns I use sequence formula within vlookup.
This makes an array of numbers with defined step. So if you can have every 6th column you define step as 6. Here step is defined in cell c23
=ArrayFormula(vlookup(A24:A43,A2:AB21,sequence(1,5,4,C23),false))
Of course it can work in multiple sheets or files. You just need to use importranges instead of standard references to a range.
Short question: Is there a way to get a formula that references a column in an Excel table to always refer to only the column with that name? This is a straight-up formula question, not VBA-related.
Formula:
=COUNTIFS(Table35[[dc]:[dc]],$A6)
In this case column A has a data center name in it. Table 35 is the output of another program that produces data for an ETL and also most of the same data for this spreadsheet that is used for both analysis and status reporting.
Problem
Due to the nature of analysis, the shape of the data changes. It seems like about once a week there is another variable (column) that needs to be added to the ETL and analysis. I've simply been copying the program output, going to the upper left hand of the table and pasting. For all of my PivotTable analysis of this data it works exactly the way I want it to.
The problem happens to my dashboard built with various Countifs() formulas like the one above. My initial expectation of behavior is that by referencing the data (first by column name and now as a range of columns that contain only one column of data) that Countifs() would select the data based on column header value (much like using vlookup() + match() together).
Instead what happens is that when a column gets added the names in all of my formulas change. It appears the internal representation essentially says I want column #N. No matter what data happens to be in column N, that is what shows up. So for example, [dc] above turns into [CS Windows Error Message]
Is there any way to indicate that I want the column named "dc" regardless of where in the table dc is located? Even the great and omniscient Google has failed me on this one. Help appreciated.
Try wrapping the table reference into the Indirect function. That will preserve the column name and return the correct value.
=COUNTIFS(INDIRECT("Table1[dc]"),2)
or, with your formula
=COUNTIFS(INDIRECT("Table35[[dc]:[dc]]"),$A6)
This question was asked and the answer ALMOST works for me.
THE PROBLEM
Very simply from the above dataset I wish to recreate this range but filter for only select BLOOD TYPE O.
The answer given is:
=IFERROR(INDEX(A:A,SMALL(IF(ISNUMBER(SEARCH("O",INDIRECT("$A2:$A"&COUNTA(A:A)))),ROW(INDIRECT("$A2:$A"&COUNTA(A:A))),""),ROW()-1)),"")
This works only in ROW 2. I have tried everything to get this to begin in a new row and column (I also want the data to be in a different row and column) but whenever i update the formula, nothing is returned.
ED please see this new picture:
In the image above, I place your example data set in the range C3:F13. Based on your question it sounded like you were trying to filter your list based on blood type, but I was not sure if you just wanted names, or some other combination of columns. This solution assumes you want all columns in the order they are presented. I placed the following formula in I5:
=IFERROR(INDEX($D$4:$F$13,AGGREGATE(15,6,(ROW($C$4:$C$13)-3)/($C$4:$C$13=$I$2),ROW(A1)),COLUMN(A1)),"")
In I2 is the value of the blood type you are filtering your list for.
in the formula above, adjust the ranges to suit your data range locations. The -3 in the formula is for the number of header rows before the data starts. If you have headers or other space and your first piece of data was in row 15 then you would need to change -3 to -14.
I have a worksheet where data is updated from an external source. The page contains data from today going out 20 days. I have a named range for each column i.e. Today ($D$4:$D$50), Tomorrow ($E$4:$E$50), etc, etc. My issue is that sometime the data from the external source does not contain data so nothing is populated in the columns. However, when there is data being returned again the name ranges are automatically changing i.e , Today changes to ($F$4:$F$50). No new columns are being inserted or deleted.
How can I specify / force the name ranges always to stay the same i.e. Today is always column E, I thought that was the point of the $.
Thanks.
you could try this formulae for your named range formula.
In Name Manager, edit your named range and pop a modified version of the formulea below into the refers to: field.
The modifications will be to the numbers within the address() function. The first value is the row number, the latter is the column number, so Column A = 1, Column B = 2 and so forth.
=INDIRECT(ADDRESS(1,13)&":"&ADDRESS(50,13))
It then uses the indirect function plus a concatentation of the 2 address functions to change formulae to a cell reference that the named range can use.
So the example above, means my named range will go from M1:M50.