Dynamic Name Ranges with Pivot Table Data - excel

I'm trying to create dynamic name ranges using data presented in a pivot table. See below:
I would like to create a dynamic name range that captures this data. Here is what I wrote:
=OFFSET(INDIRECT(CONCATENATE("'R1'!",(CELL("address",INDEX('R1'!$A:$A,MATCH(MIN('R1'!$A:$A),'R1'!$A:$A,0)))))),0,0,COUNTIF('R1'!$A:$A,">1/1/2006"))
The first argument of this offset formula is multi-part: I had to first find the first date in column A using INDEX('R1'!$A:$A,MATCH(MIN('R1'!$A:$A), then find the address of that cell, then present it properly for the offset formula using concatenate (to append the sheet name) and indirect.
For the height of this name range, I used a COUNTIF function to get the amount of dates in the column.
However, when I assign that formula to a name range and tested it in a pivot table, I get the error "Reference isn't valid". Any ideas?

#Edmond Liu You should first name the range in on the tab where the data will live. After that then configure the pivot table to place data in the dynamic named range space.
Another option is to place your pivot table in say Column C or D. In column A or B put your dynamic named range along with some logic formulas to extract what you actually need from the pivot table. As the pivot table changes your formulas will automatically update. You can include to IFERROR/ISERROR logic to exclude blank or null cells.

Related

Excel Data validation list with array formula

I have a table with duplicated values in a column. How can I use this column, to provide unique values as a dropdown options in another cell? I want to be able to enter new rows in my table that might include already existing or new values and dropdown should automatically reflect this.
What I tried with UNIQUE(MyTable[MyColumn]):
Excel is not accepting this formula as a data validation source
I can spill UNIQUE(MyTable[MyColumn]) to range and name this range and use it as a data validation source, but the named range will not expand/contract automatically when my table data change
Excel will not accept UNIQUE(MyTable[MyColumn]) in a new table
You are on the right way - and yes: this is annoying and definitly not intuitiv.
You have to add a # after the reference to your range when naming it:
Then use the name for your validation list. It will now expand when you add a new row to the table.
D3: UNIQUE-Formula referencing the table-column
Name "lstValues": referencing $D$3#
then use lstValues
Alternative solution
Insert Power Query referencing original table as a source: = Excel.CurrentWorkbook(){[Name="MyTable"]}[Content]
RMB on a column to keep, Remove Other Columns (if any)
RMB on a column, Remove Duplicates
Close and Load to the sheet as a table, name table DropdownTable
Define new named range DropdownValues with reference to =DropdownTable (or =DropdownTable[#All] to include header)
Use =DropdownValues as a data validation source

How to reference Data from PowerQ that can change row

Good Afternoon.
I have a workbook that basically uses power query to take data from the CoinmarketCap Api and displays this to a sheet called "CMC".
I have a second sheet that references data in the CMC sheet. (Seen Below)
Table referencing CMC sheet
For example cell D4 references =CMC!M2+0
This is referencing the Bitcoin row which is row 2 in the "CMC" sheet. If, for example Bitcoin moved to row 3 on the "CMC" sheet then my table would be messed up and replaced with values from the new coin moved to row 2.
Is there anyway to Dynamically reference the data from the "CMC" sheet so that if a coin moves to a different row my table on sheet two can still update accordingly without me having to manually change the row?
CMC Sheet
Load the powerquery result as a pivot table report not a table
Then pull desired data from pivot table with GETPIVOTDATA formula
To enter formula, type = then click on desired cell in pivot. Example output:
=GETPIVOTDATA("Sum of Column1.price_usd",pivot_tab!$A$3,"Column1.symbol","XRP")
Alternately, leave it in the table, and use vlookup or index/match on the symbol :
=vlookup("XRP",table_tab!$a:$f,3,false)
similar to
=index(table_tab!c:c,match("XRP",table_tab!a:a,0))

Sum all new dynamic rows records excel sheet

I am looking for a formula to Sum all the rows in A column, the rows count is not known as user can enter runtime. Every formula on google is taking nth row range.
Since you have used table you can use the table name references in your formula. Every time the table size increase or decrease in row numbers, the formula will adjust to the new range, given the same header name is used.
So the formula for column A (entered in cell H10) would look like this:
=SUM(Table1[[#All];[Value]])
Table1: Is the name of your table. Click on your table and go to "Design" (see picture). At the very left you have the table name, in my case "Table1".
[#All]: Defines what you want to look at, in this case all values.
[Value]: Which column (header name of the specific column) you want to evaluate.
The formula for the other looks like (cell H11):
=SUM(Table1[[#All];[Mortgage]])
and (for cell H12):
=SUM(Table1[[#All];[Amount]])
There are function options with Table use that Option to add sum of that column then you'll get sum of column A when use that option!
Check this link: https://www.ablebits.com/office-addins-blog/2014/10/31/excel-sum-column/ -- check "Convert your data into Excel table to get total for your column" in this article.
it has detailed information how to do various operation with sum!

Complicated Formula Issue adding specific values based on a parameter

I have a table A and table B. Table A is the input table and table B is the output table. Table A has 2 Columns; Name and Quantity, and table B also has 2 Columns Name and Quantity, but the difference is that table B already has 48 names written inside it and the Quantity section is empty, And the whole of table A is empty. I'm not doing a very good job of explaining stuff. I know but if you are with me so far then.
Now I go to table 1 and put in the following data in the syntax [Name,Quantity] : {Sam,10},{Lilly,15},{Sam,25}. After putting in that data, I want the appropriate quantity cell in table B corresponding to the names to be equal to the total quantity each name has in table B.
In this case I want the output of table B show me {Sam,35},{Lilly,15} and the rest of the Names = 0.
I would prefer if this method stays in the terms of excel formula calculations and no macros or VBA as it will be easier for me to integrate this with the other functions of the spreadsheet I'm making. But I would not mind having alternatives.
If your data format is like this:
You could use either SUMIF or a Pivot Table
If you use SUMIF, then you could list all the names with zero's.
If you use a Pivot Table, a list of names will be generated automatically.
For SUMIF, if the Quantity column of Table B starts in B2, you could use a formula like:
=SUMIF(Table_A[Name],A2,Table_A[Quantity])
and fill down to last row.
If Table A is not a "real" table, just substitute the range references for the appropriate columns.
Results of the SUMIF method:
If you want to use a Pivot Table, then with the cursor in Table A, select Insert / Pivot table. Then drag Name to the Row Labels area, and Quantity to the Values area. Format to taste.

Excel Data Validation List using formula with filtering

I have following workbook:
Worksheet Accounts:
Worksheet Posts:
I would like to know if it is possible to define Data Validation of type List to entire column B in sheet Posts using formula, so that Data Validation popup shows only Account Ids from Accounts sheet which Website column matches Website column of a selected row in Posts sheet and which have value Active in Status column?
In SQL-ish or LINQ-ish words:
SELECT Id FROM Accounts WHERE Website =
#SelectedPostRow.Website AND Status = Active
Marks on the second image shows which values should be shown in a drop-down.
Yes you can do this, but it requires some supporting setup.
First for each of your website options, you need to create a named range for the options that would be in the drop down you are seeking to create.
To do this, just highlight the list of cells and right click, the choose Name a Range
Then you need to create a lookup list for your website names to the named range possiblities
Then in your data validation source use a forumla like this:
=indirect(vlookup(a1,$i$8:$j$13,2,false))
then whala, the dropdown list changes based upon the website value.
Now if you are also needing to automate the named range bits, you could change them to encompass entire columns and then use a pivot table to pull in the data. Would just need
an independant pivot for each website option.
Each time you pulled in fresh data you would need to refresh the pivots, but it would function.
This problem need a bit of a preparation.
In the same sheet, or in another, copy your data (or add the relevant cells)
In column A you have a number that could be ranked.
I obtained it with (cell A2):
=IF(C2=$J$2,1,0)*IF(E2="Active",1,0)*ROW()
In column B rank the number and exclude the unwanted rows (B2):
=IF(A2=0,0,RANK(A2,A:A))
Then you can VLOOKUP in column H, using a enum in column G (manually entered). The formula for H1:
=IFERROR(VLOOKUP(G2,$B$2:$D$9,3,FALSE),"")
Now you could set your validation based on column H
PS: there could be small errors in the formulas as I have translated them from italian and I cannot test in english.

Resources