I am new to using Excel formulas.
I have an Excel with alot of formulas like
=IFERROR(VLOOKUP(B9,Data[[#All],[Field Location]:[On Production Date]],4,0),"")
I understand IFERROR function and VLOOKUP function.
What makes trouble understanding is table array in VLOOKUP function which is
Data[[#All],[Field Location]:[On Production Date]]
What this table array represents and how can I create something like this?
These are structured references. You can read more at:
Using structured references with Excel tables
Structured references make it much easier and more intuitive to work
with table data when you are using formulas that reference a table–
either portions of a table or the entire table. They are especially
useful because table data ranges often change, and the cell references
for structured references adjust automatically. This minimizes the
need to rewrite formulas as rows and columns are added and deleted in
a table, or when external data is refreshed.
Data[[#All],[Field Location]:[On Production Date]]
is the equivalent of giving a range. $Field Location2:$On Production Date1000, ($A2:$B1000)
assuming there are 1000 rows in your table. Writing the formula in this way will automatically include any new rows added to your Data table.
Data[[#Header],[Field Location]] is equivalent to $Field Location1. Or $A$1.
In Excel, you can give names to certain ranges. Just mark an area, and then on the top left (below the menu), you can enter a name in a drop-down-box.
This name can then subsequently be used in referencing the range, like it is shown in your formula.
This is more intuitive than writing A2:G98, and even more, when you insert new rows into the range, then they will automatically be included.
Related
I am looking to have some summary stats for a table that is generated by a query on another tab, but all the approaches I have taken fail for some reason.
Using cell references - COUNTIF(INDEX(Errors!$A$2:$Y$692469,0,MATCH("INCORRECT",Errors!$A$1:$Y$1,0)),TRUE)
With this approach, when the table is generated, the references, even though they are anchored, adjust to the first column that is not part of the generated table.
Using structured references =COUNTIF(Errors[INCORRECT],"True")
This only works if the table already exists with that column. If it doesnt exist, excel wont even let me put in the formula. The formula error dialog pops and I cant save it there.
Creating a table stub that has the columns I want. For instance, I have a table with headers of ID, INCORRECT with one empty row. When I do it this way, the query ends up creating new columns (INCORRECT2) rendering the structured reference worthless.
So, any suggestions? One complexity is that the the table output does not have completely predictable column names. The ones that I want summary stats on are predictable, however, the other ones are not and in fact there could be a single other column or multiple. So that's annoying. I do know what the names (and quantity) of the other columns are. These are established connections.
So the indirect function was the way to go.
=COUNTIF(INDEX(INDIRECT("Errors!$A$2:$Y$692469"),0,MATCH("INCORRECT",INDIRECT("Errors!$A$1:$Y$1"),0)),TRUE)
I have an excel spread sheet that summarises a Table of data, currently using the Sum(countifs()) functions to look up columns and Count the number of time specific Criteria are meet. Two of the criteria are in the form of Arrays. i would like to change these to Named Ranges and reference them so I can more easily maintain the form.
Had a look around online with no luck. Tried a few versions of Sumproduct but couldn't figure it out.
SUM(COUNTIFS(InspectionCompany,{"Company 1","Company 2",...,"Company 8"},InspectionType,"*Part of Inspection Title*",InspectionCreatedBy,{"Name 1";...;"Name X"})))
in this case the Function works and I get the expected result. But I would like to change the Company Array and CreatedBy Array to both be Named Ranges so I can just update the one spot and not have to worry about replicating the function.
I don't have much experience with VBA so would like to avoid that if I can.
Let's say that the range containing the list of companies is named CompanyArray, and that the range containing the list of names is named NameArray. If CompanyArray refers to horizontal range of cells and NameArray refers to a vertical range of cells, try...
=SUMPRODUCT(COUNTIFS(InspectionCompany,CompanyArray,InspectionType,"*Part of Inspection Title*",InspectionCreatedBy,NameArray))
If CompanyArray and NameArray both refer to a vertical range of cells, try the following formula that needs to be confirmed with CONTROL+SHIFT+ENTER...
=SUM(COUNTIFS(InspectionCompany,TRANSPOSE(CompanyArray),InspectionType,"*Part of Inspection Title*",InspectionCreatedBy,NameArray))
Hope this helps!
You can do complex counting logic using pivot tables in excel. There are lots of different drop down options are available in the pivot table set up including different filter, grouping, counting and summation options.
I have a table that I am using to summarize some data from other tables; the data is almost entirely text so a pivot table isn't the answer. I have a table on a worksheet as follows...
Here is a typical formula for columns D:L...
FORMULA: =INDEX(tblITPM,MATCH(tblHCSmry[[#Headers],[Data Source]],tblITPM[[#All],[Column1]],0),MATCH([#MetricName],'SheetA'!$A$2:$D$2,0))
Individally, the formulae seem to work fine but the total of the calculations only works in the first 3 rows of my summary table (tblHCSmry). There are two issues that I don't know how to solve:
In the "array" section of the INDEX I am referencing table
names that are listed in column B (TableName); hard-coding like I
have above (tblTableA) makes all of the items that need to reference
a separate table on a separate worksheet to fail.
The MATCH formula (MATCH([#MetricName],'1_ITPM_Summary'!$A2:$D2,0)) have a similar issue; I get the correct answer for the first 3 tables (2, 3, or 4) which I expect since the "lookup_array" is hard-coded. So, the issue again arises though when I want to reference a different table such as tblTableB by pointing to Column B of tblHCSmry.
I suppose the main question is: can I use a named range of a table, or do I need to use the "'SheetA'!A3:D3" format? If so, is there a way to dynamically change, "'SheetA'!" to "'SheetB'!" by referencing Column B of the tblHCSmry? FWIW: I tried to CONCATENATE the Sheet name with the reference and that didn't work.
You can use named ranges, but you'd need to have pointers to the location of the data in cells, which appears to be what you already have in Columns A and B. You can then reference those dynamically using using =INDIRECT(). =INDIRECT() allows you to take a value of a cell and use that as a reference as opposed to the reference being to the cell itself.
For instance
=INDEX(INDIRECT([#TableName]),MATCH(tblHCSmry[[#Headers],[Data Source]],tblITPM[[#All],[Column1]],0),MATCH([#MetricName],INDIRECT("'" & [#TabName] & "'!$A$2:$D$2"),0))
Would make your return array whatever is referenced in [#TableName], and your array parameter in your second MATCH function would be whatever is referenced in [#TabName]
MSDN has very basic documentation of INDIRECT() here, but there's quite a bit you can accomplish with it as far as creating more dynamic formulas.
I have a database of multiple tables and am trying to design an equation in Excel that will return the height of a given toy from a specific manufacturer. What is the best way to go about using two inputs? i have tried working with VLOOKUP() but was unable to tailor it to my needs. I also tried nested IF statements which greatly complicated my equation and will only work with small amounts of data. Is this possible to do in Excel and if so how? The equation in the image below has dropdown selectors which aren't displayed here.
The answer that I'm giving here will require that you rearrange your data tables a little bit, but has the benefit that it can be easily extended later on to deal with any additional data and additional lookup conditions.
Steps:
Move all your data tables into one single contiguous table, and add one additional column for 'Toy type' (as shown below).
Enter the formula as shown below into a cell, but without the outer braces. Then then press Ctrl+Shift+Enter (this tells Excel that the formula is an array formula and results in the braces being added).
The lookup formula in this case is made up from an INDEX and MATCH function. This combination allows you to define multiple lookup-criteria. How this works exactly is explained in more detail here and here.
Well it looks like you've got two lookup tables... So depending on the Toy Type cell, you'd lookup vlookup area1 or area2.
See here
Results
Formula
You might like to make cell B8 a drop down list too if you were to use my layout in Excel rather than Googledocs. See my answer here
You can do a lookup based on the Toy Type to choose the range for your other lookups.
I made a table with ToyType and CellRange. Assuming your Dolls table started at B2 you would have ToyType = Dolls and CellRange = C3:D9 etc.
Then make a lookup using =VLOOKUP(SelectedToyType, NewTableRange, CellRangeColumn, FALSE)
Finally in your Toy Height lookup it would be =VLOOKUP(SelectedToyHeight, INDIRECT(FirstLookup),2,FALSE)
This will let you keep the same basic table structure, and be able to add more toy types / adjust the lookup ranges in the future.
I've been trying to find a list of the built in MS Excel functions that calculate "Whole Column" formula efficiently but haven't been successful, any ideas where I can go for this information? What i mean by this is exemplified below:
This documentation suggests that SUM and SUMIF formula automatically pick up on the last row of data, thus meaning that there is no efficiency reason why using a more restricted or dynamic range is preferable.
https://msdn.microsoft.com/en-us/library/office/ff726673(v=office.14).aspx#xlAllowExtraData
Answers for Excel 2003/7/10 are all welcome.
I think it would be fair to assume that ALL excel functions behave as teh article describes (ie the same as SUM and SUMIF). (I wasn't aware of this article, but it makes sense when you think about it...)
Behind the scenes the data in cells is stored in OO data structures such that only cells with non-default values and formatting will have been created.
It's highly probable that the value data and formatting data are help in separate containers.
So when Excel is using a formula on a range it is working on the data structures and consequently only works with the cells that have values.
I hope that a whole column with cells having different formatting (but very values) does not cause the SUM and SUMIF formulas to scan through every cell.
If in doubt you could do an experiment with the formulas you want to use.
The link you gave talked about formulas that behave differently and explicitly named VBA user created functions and array formulas - which makes sense.
Also, note that the article says using "Structured Table References" is the best approach. (ie not only storing your data in ranges but storing your data in excel tables. Created from a range using Ribbon:INSERT>Table).
These tables will allow any function to be used more efficiently as the range used is limited to the number of rows the table has.
I hope this helps.
Harvey