I have some testing data that has been run every quarter for several years.
Each table corresponds to one quarter, and has the results for four tests by office. This data is organized in Excel as follows (this is a small sample):
Using this data set, I need to fill out this summary table:
Basically, I need to look up the value in the data set that would correspond to both the row reference and column reference. For example, row reference "UK" and the column reference "Test 1A-Q217", returning "14.85" in the summary table.
I tried using an INDEX( MATCH, ( MATCH)) formula, but that didn't work. Since the tables are laid out one after another, it would just return the results of the first table instead of the reference that matched more closely further down. What would be another way to fill out the table?
My ideal way:
Use OFFSET inside a VLOOKUP to dynamically set the vlookup area. I would first modify your data set the following ways:
Change the header rows such that col A states the quarter (e.g.
"Q1-17") and the other headers just state the Test (e.g. "Test 1A").
This is not a MUST, but will make things significantly easier. If you don't want to mess with your data, you can add a col above/below yur current headers to does this for you using LEFT/RIGHT/SEARCH (see other threads for extracting sub-strings from strings)
In your output table, put test in 1 row (e.g. "Test 1A" in row 1) and date in another (e.g. Q1-17" in row 2)
Your new formula would look something like this
=VLOOKUP($A4,OFFSET($A$3:$G$14,MATCH($V1,$A$3:$A$500,0)-1,),MATCH($V$2,$A$3:$Z$3,0),0)
What is happening is that you are doing normal VLOOKUP with 2 modifications to make it more dynamic. yous set the lookup table using OFFSET and you set the column using standard MATCH approach.
You may need to make additional modifications since I have added a row to your data set.
Note: I have not tested out this formula, you may need to make minor adjustments to the formula but this should get you what you need
Alternatively, you could create named ranges for each of your data sets and have a VLOOKUP inside your main VLOOKUP that selects the correct named range to look inside of. I think this is less elegant, will take longer to set up, and and adds additional work every time you want to add another data set each quarter.
Related
I have an excel file with lots of variables in columns. I want to make nice tables in a different tab (and do not want to use 100s of pivot tables). I need to check each column for specific values. In fact each column becomes a table. I am using the countifs function. To efficiently do that I want to refer in the tab where I make the tables to the tab where the data is stored (same file), that reference is static. For each and every table I need to refer to a different column, so that is the dynamic part. In stead of changing all formulas for each table, I prefer to have a reference to the specific column in one cell (for each table). I know I have to use the indirect function, but can't get it work.
=countifs(worksheet!E:E;b4)
where the E:E part should be dynamic
=countifs(indirect("Worksheet!"&a4);b4) or countifs(indirect("Worksheet!"&a4;b4)) both do not seem to work
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 :-)
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)
I have two tables that get dynamically created from a database query; the first table is the source of the drop-down list, and the second is the table that I will apply the drop-down list via data validation. First table:
and the second table:
What I need, ideally through just Excel formulas, is an intelligently designed drop-down that shows only the dimension values associated to the dimension in question.
So in cells B3:B10, the drop-downs would show a,b,c. In cells C3:C10, the drop-downs would show 1,2,3. In cells D3:D10, the drop-downs would show x,y,z. Etc, etc.
I need this to be dynamic in the sense that a week from now my DB query may return a fourth dimension that would need to follow the same approach.
Not sure if this is even possible without writing some VBA, but I figure I'd see if anybody has any creative ideas. Cheers!
You have to use Name Manager and =INDIRECT() formula to achieve that.
First download the sample file.
Sample File
See this tip (By me). It will help you to see screenshots step by step. Link is here
Now in-case of your data you have to use some formula to filter data automatically when new data come. So that new data can organize for dynamic combo boxes. I can also do that for you if you are not able to do that. Then share your sample workbook with me.
It is very possible, but not simple. There are a several ways to implement this, depending on your requirements, how dynamic it needs to be, and the expected structure of the data (as I mentioned in a comment).
I will give one possible solution, that is mostly dynamic, and is the simplest to explain. You can use a similar logic to make it all dynamic.
This solution will retrieve the data from table #1 according to the dimension name, assuming it is not sorted, and return the values in the order they are given in the table.
For some of the ranges I create names for simplicity, and some are mandatory. In order to follow the formulas logic you need the named ranges I use.
Create named ranges for table #1: (Either by using the Name Box or using the Name Manager Ctrl+F3):
For the data in the column Dimension: DimName =B3:B11
For the column Dimenstion Value: DimValue =C3:C11
Create dimension values lists in a new sheet:
Put the dimension name in B2 ="Customer". (The available dimension names can be created dynamically as well, but I'm skipping this part for simplisity).
B3 (array formula - Ctrl+Shift+Enter) =IFERROR(INDEX(DimVal,SMALL(IF(DimName=B$2,ROW(DimName)-ROW(INDEX(DimName,1))+1),ROWS(B$3:B3)),1),""). This formula returns the k-th value for the "Customer" dimension.
Copy B3 down to as many rows you think you'll need. Let's say B4:B10, so B3:B10 will have the array formula. The first cells will have the available values and the remaining cells will be empty because of the IFERROR function.
In B1 we will count the available values using the formula =SUMPRODUCT(--(B3:B10<>"").
Do the same for "Product" and "Geography" in columns C and D.
Create dynamic named ranges for the lists: (using the Name Manager Ctrl+F3)
For the lists' data DimLists =B3:D10.
For the lists' headers DimListHeaders =B2:D2.
For the lists' counts DimListCounts =B1:D1.
*These names are mandatory for the data validation to work in another sheet.
Set table #2 data validation list sources:
Select B3:B10 in table #2.
Go to Data > Data Validation, and select Allow: List.
Put the following formula in the source: =OFFSET(INDEX(DimLists,,MATCH(B$2,DimListHeaders,0)),,,INDEX(DimListCount,,MATCH(B$2,DimListHeaders,0))). This formula finds the correct list in DimLists according to the column header in table #2, and also sets the returned range height according to the list count.
Hope this helps.
Is there any way to look up and display the latest value in a group that does not have a set range?
Here's a breakdown of a question. I am working with some data that I like to break into data groups that can be collapsed. On a weekly basis I un-collapse the group and insert a line at the bottom with the new information. I would like that latest bit of information to be automatically displayed on the top cells that is displayed when collapsed.
I have used look-up tables and I have a function that I used for testing purposes: =LOOKUP(2,1/(C5:C11<>""),C5:C11) that obtains the last cell within that designated ranged: C5-C11.
Now can I do something similar within grouped data values that have no defined range?
One way to do this is with an index function, assuming that there are no other rows of data on this worksheet other than the group that you're trying to find. Here's an example of a formula that could work for you. It assumes that your data starts in K2 and you want to have your result in K1.
=INDEX(OFFSET(K2,,,ROWS(K:K)-ROW(K2),1),MATCH(9.99999999999999E+307,
OFFSET(K2,,,ROWS(K:K)-ROW(K2),1)),1)
The offset creates an array for all cells below k1 without counting k1. The match function searches for the largest number possible, this formula assumes that you're looking for numbers. If you're looking for text, or a combination, you'll have to use a different formula by replacing the match portion with:
MATCH(REPT("z",255) 'for text
MAX(MATCH(9.99999999999999E+307,range),MATCH(REPT("z",255) 'for numbers and text
Source: http://www.techonthenet.com/excel/questions/last_value.php