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

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.

Related

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

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

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.

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