How to reference Data from PowerQ that can change row - reference

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))

Related

Excel - get data between two sheets by find number and lookup data

I have sheet Result and want to get data from sheet Source.
Pls help to show me how can I get data as image following.
Tks you so much !
First option:
Un-merge the cell in source sheet and instead of "Detail", type meaningful column names to B1 to F1.
Then select your data and create a pivot table (pls do some google if you need to).
Play with pivot table until you reach the view you want (it is possible to get the same view as the result sheet you shared.)
Second option as you requested:
Insert a new column after column A in your source (between abs and roma).
Type this formula in this new column: =A2&H2.
Then type this formula in Result sheet B2: =Vlookup($A2&"2";Source!$B$2:$G$13;3;false)
Copy this to other cells. Do not forget to update parameters for other cells.

Dynamically fetch values which uses complex formula from another sheet

I'm using Excel 2019 (as I don't have office 365 subscription) and I've attached excel sheet at https://ufile.io/5xlkh1v3 which contains Data and Graph sheets. Data sheet contains stock tickers, quantity, date acquired, etc and Graph sheet contains array formula in column A which finds unique stocks in particular hard coded account (say eTrade from Data sheet). Similarly, column B contains formula to calculate cost for those tickers from Data sheet. Everything is working as expected in the sheet except that when I insert row in the middle of data sheet, the populated values from column A in sheet Graph disappears as the hardcoded cell reference changes.
Can someone help in making this complex array formula in column A from sheet Graph dynamically change so that its populated values will retain?
Thanks!
It would be better to post the formulas you used and ask why they cause trouble.
The following formula in Graph!A2 causes the error:
=IFERROR(INDEX(Data!A:A,SMALL(IF((Data!$I$2:$I$20="TD Ameritrade")*(Data!$J$2:$J$20="Stock")*(Data!$D$2:$D$20="")*MATCH(Data!$A$2:$A$20&Data!$I$2:$I$20&Data!$J$2:$J$20,Data!$A$2:$A$20&Data!$I$2:$I$20&Data!$J$2:$J$20,0)=ROW($1:$19),ROW($2:$20)),ROW(A1))),"")
If you insert a row somewhere in Data!$2:$20 your formula will dynamically widen that range, but this part of the formula: ROW($1:$19),ROW($2:$20) will not expand, since it's not referring to Sheet Data! if you include that it'll expand as well:
=IFERROR(INDEX(Data!A:A,SMALL(IF((Data!$I$2:$I$20="TD Ameritrade")*(Data!$J$2:$J$20="Stock")*(Data!$D$2:$D$20="")*MATCH(Data!$A$2:$A$20&Data!$I$2:$I$20&Data!$J$2:$J$20,Data!$A$2:$A$20&Data!$I$2:$I$20&Data!$J$2:$J$20,0)=ROW(Data!$1:$19),ROW(Data!$2:$20)),ROW(A1))),"")

Copy multiple cells from two separate sheets based on input

I have three sheets:
I manually copy values from column A in Sheet 1 into column A in Sheet 3 and from Column A in Sheet 2 into Column B in Sheet 3 (as shown in the attached images).
The values are selected based on Column A and Column E. E.g. in Sheet 3, Q001-1 S1 from Sheet 1 is copied with G001-3 S3 and G002-2 S2.
I would like to simplify this process as much as possible because it is time consuming- however I cannot find a way to do this.
Is this even possible, using formulas or VBA??
if i understood correctly you need to perform a join in Excel using the cell ID as a criteria.
I'd use Power Query instead of VBA because it's the tool made just for this kind of task:
Select the original table and format it as a table (Tab Home) -
perform this operation for both data source
Format as a table
Load both tables into PowerQuery (click on the table and then go to Data/Get and TrasformData and select From Table PowerQuery repeat this step for both tables
From the table 1 select the tab Home select Merge, then choose the cell ID as a criteria (use the default left join) Join
Click on the new column to spread the data, remove uneccessary columns
Close and load (top left) your query into a new sheet (sheet3) - Load only the output table and not the original tables since they aren't necessary
To automate the process simply add new rows to the original tables and then click into the tab Data and then Refresh all. The results will appear into sheet3
I hope it helps!
Emanuele
If your plan is arbitrary or based on criteria that can't be determined mathematically, it can't be solved with code alone. If you'd like to plan your arrangement on a 4th sheet, however, you can write conditional formulas in each cell on sheet 3 that evaluate your plan on sheet 4 and compare them to the cells containing the strings S1, S2, and S3. In cell A2 you could paste the following;
=IF((EXACT(Sheet1!E2,Sheet4!A2)),Sheet1!A2,IF((EXACT(Sheet1!E3,Sheet4!A2)),Sheet1!A3,Sheet1!A4))
It's evaluating the corresponding cell on sheet 4 for an S1 or S2, if it sees neither, it assumes S3. It then chooses the corresponding cell on sheet 1. The code in column B evaluates the corresponding cells on sheet 4 using the same trick;
=IF((EXACT(Sheet2!E2,Sheet4!B2)),Sheet2!A2,IF((EXACT(Sheet2!E3,Sheet4!B2)),Sheet2!A3,Sheet2!A4))
It then chooses the corresponding cell on sheet 2. You can drag these cells down as far as you need.
I wrote a working model and posted it to GoogleDocs

Dynamic Name Ranges with Pivot Table Data

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.

Transform badly formatted excel data into a form for pivot tables

How can I transform data in excel in this form (see image here: http://imgur.com/PgX5r) into something suitable for using in a pivot chart. I need three columns eventually, Date, Country and Score. The amount of data points for each country is not constant.
The easiest way i found without using VBA is to use an array formula :
Add another column on the left of your values (let say Col A)
Set this formula on cell A1: {=INDEX(B:B,MAX(IF(ISEMPTY($C$1:C1),ROW($C$1:C1),ROW($C$1))))}
Validate with CtrlShiftEnter
Drag the formula till the end of your values
Your data are almost suitable for a Pivot Chart. What you can do next is to delete unneeded rows (with country names and headers) or use another formula on another sheet to "duplicate" the data except when unwanted rows (you can then filter the blank data in the pivot chart).

Resources