VLOOKUP to bring data from another sheet - excel

I have a table containing a some football data, such as Country, League, Teams, Standing table information, such as total matches played, wins, draws, losses, goals scored and conceded, and so on.
Here's a file download link
It contains two sheets.
First sheet is STANDINGS_EXTENDED:
I need to fill these 3 tables with the data contained in another STANDINGS worksheet.
Here's a screenshot of the STANDINGS sheet:
My aim is that once I fill LeagueId and Group Id (which is optional) fields then inside all three tables will be produced the data as in this sample.
I wonder if it is possible to achieve this without VBA. But i have no clue on where to start from. I tried is several different ways, but i get only first result from STANDINGS worksheet for any league i enter.
Looking forward to your help.
Thank you!
UPDATE:
So far I could get the count of rows related to Overall, Home and Away using these formulas:
=COUNTIFS(STANDINGS!E:E;STANDINGS_EXTENDED!E1;STANDINGS!F:F;"StandingsOverall")
=COUNTIFS(STANDINGS!E:E;STANDINGS_EXTENDED!$E$1;STANDINGS!F:F;"StandingsHome")
=COUNTIFS(STANDINGS!E:E;STANDINGS_EXTENDED!$E$1;STANDINGS!F:F;"StandingsAway")
Also, what I can get is the first row of these results using this formula:
=VLOOKUP($E$1;STANDINGS!$E:$V;4;FALSE)
What I need to figure out is how to modify above formulas so that I fill tables with remaining rows.

In order to do this you need a formula in every single field of your 3 tables that link it to data on the Standings tab. That would be 13 x 3 x 20 formulas. Therefore one would try to create formulas that can be copied, in the best case less than 13 original ones, but definitely one formula for each field.
Each formula would look for a unique identifier in the Standings list. I can't see any unique identifiers there but you might create them by concatenation, such as "League" + "Country" + "Position". The more detail you need the larger the formula. The key is: without a unique identifier for each row you can't retrieve data. But once a row has been identified you can get the value from any of its columns.
If your tables sometimes have 12 rows, sometimes 20, and sometimes 25 you must provide space for the possible maximum and then design your formulas to return a blank if there is nothing to display.
In conclusion, the core of your system is in the Standings table. It must be set up so that data can be retrieved from it. Ideally, your selection on the Standings Extended sheet would generate a concatenated unique identifier for a list to which you can add the fixed number in the Pos column to identify individual rows in the Standing table. As long as you can't identify rows no data can be retrieved.
Using VBA gives you more flexibility but doesn't relieve you of the task to create uniquely identifiable rows.

Related

How can I make a drop down list in Excel 2013 based on several conditions?

What I would like to achieve is that sellers can choose the STORE in the blue cell (either with a drop down list or by hard-typing the STORE name) and, based on the selection on the blue cell, the available POSITIONS for that particular PRODUCT and that particular STORE are show in the green cell as a drop down list.
Let's say I have an Excel workbook, which contains a worksheet with this table with products data, which is automatically imported daily from our Nav server with this layout. It has 4 columns including PRODUCT CODE, DESCRIPTION, STORE IN WHICH IT CAN BE LOCATED and POSITION INSIDE DE STORE (please, check screenshot). It contains 1.5k rows and it changes dynamically, for example, new items are added or positions are exchanged.
As you can see, the same product (PRODUCT 2) can be located in several stores (STORES 1, 2 and 3), and it can be in several locations on each store (POSITIONS 2, 3, 1 and 4).
Now I need sellers to report which of these items they pick and from where, not only the STORE but its POSITION inside the store too. They do it with another worksheet inside the same Excel workbook. It looks more or less like this (please, check screenshot).
I know the drop down list is achieved via Data Validation but I can't figure out the formula for this. I have tried several approaches like:
Array formula to return all POSITIONS in the same ROW, following this (Formula 2.): https://www.ablebits.com/office-addins-blog/2017/02/22/vlookup-multiple-values-excel/. It is quite slow to calculate on the 1.5k items and, once done, I can't figure out how to make Data Validation to look for the 4 or 5 or 10 POSITIONS returned by the array formula, which also need to be filtered by STORE (please, check screenshot for the closest that I have been, array formula returning POSITIONS from column E).
Same formula as above directly on the Data Validation list box, which returns only the first POSITION found.
VBA custom fucntions which are not allowed in the Data Validation box.
I feel comfortable with both Power Query and VBA, and forumla as well, and can adapt most of the code I see but I don't know why I just can't figure out how to achieve this, maybe it is only I am blocked or something but every path I start to follow ends up in a dead end.
Does anyone have an idea on how to approach this? It doesn't really seem that complicated but it is becoming impossible for me.
Thank you very much for your time!!
This is what I have finally done, just in case someone else is facing this situation.
Instead of a plain-text table for the POSITIONS, I created a PowerQuery importing that CSV. Named that worksheet _LOCATIONS.
Added a custom column (Column E) combining the PRODUCT and the STORE so I had something like a Unique Identificator, resulting something like this but in PowerQuery.
Combined column:
Sorted column E and sub-sorted column D, so I make sure the list will always be ordered as I need, and saved the query.
Then, in worksheet REPORT, I entered this formula to create the drop down list in Data Validation in cell D2:
OFFSET(_LOCATIONS!$D$1,MATCH($A2&"-"&$C2,_LOCATIONS!$E:$E,0)-1,0,COUNTIF(_LOCATIONS!$E:$E,$A2&"-"&$C2))
And I am able to choose from the available POSITIONS for the selected PRODUCT in the selected STORE.
Brief explanation:
I set the reference for the OFFSET function in the very first POSITION (D1), and then I move it the amount of rows detected by the MATCH function (which searches for the "PRODUCT 2-STORE 2" string in the newly created combined column) minus 1 (PoweryQuery table has headers) and 0 columns. This leaves me on the first occurrence of my string (but on the POSITIONS column). Then I make the offset as high as the amount of rows detected by the COUNTIF function (which counts all occurrences of my PRODUCT-STORE pair), returning an array of all the positions (column D) matching the PRODUCT-STORE pair.
Ask for formula in Spanish if you need it.

Return all matches in columns using one criterion (from drop down on another sheet)

I am having two tables, one table (table 1) below is main data, separated into many columns and blocks per 10 rows in one, as you can see A2:A11, A12:A21 and so on (many rows and columns) ... In Column A are unique numbers, but one number per block as a unique, and all other information in other columns can differ, sometimes will be more data sometimes not. The data is always same structured.
What I am looking is to have report / printable sheet where I will have all my columns on one sheet, but in a Column A2 for instance drop down list that will use all unique numbers from main data table and populate all matches on report page, same as it is on picture below. There are many columns that should work automatically when I choose something from "Number" drop down. The trick here is, there must be 10 rows per block also, I have organized it as it should be, but I can't figure out how to populate using functions. So, you can imagine clicking one drop down and getting those lists updated without scrolling endlessly through columns and rows on main data table...
Where I have a problem is that I am getting matches only for first rows but not whole rows (or all rows where matches are) ...
using this function:
=INDEX(Table1[Datum];SMALL(IF(Table1[Nummer]=Printable!$A$2;ROW(Table1[Nummer])-ROW(INDEX(Table1[Nummer];1;1))+1);1))
If someone can help me out, I would be happy!
Try below formula. After putting formula to cell drag down and across as needed. I have tested this formula in Excel2013 and with range (not as table). So, you have to adjust formula for table. I suggest you to first test the formula in single sheet like my screenshot and if it is successful then go for table in Report sheet.
=INDEX(INDEX(B:B,MATCH($G$2,$A:$A,0)):INDEX(B:B,MATCH($G$2,$A:$A,0)+9),ROW(1:1))

How do you count the occurrence of same data set in two columns-set in excel?

How can we count the occurrence of each set of data? For eg I want to check how many time the customer country in column A comes alongside country in column B ie (How many times Australia-Australia occurs in column A and column B?). The result for unique occurrences are place in right hand side of the sheet. I have found out unique occurrences of the sets and want to count how many times each occur.
You asked for a formula, but a pivot table can do the same thing faster; and without requiring you to create the table for unique countries (option found under insert, usually the first button in the ribbon):
This is how it looks like after pulling the fields in the right 'boxes', the 'Tabular' report layout is selected and the subtotals turned off.
You can make 'Australia' repeat itself too under report layout if so you wish.
Again, SUMPRODUCT is your friend:
=SUMPRODUCT(--(($A$2:$A$11&$B$2:$B$11)=(D2&E2)))
You can use COUNTIFS function as below.
=COUNTIFS(A:A,D2,B:B,E2)
Adjust the ranges to suit your data and copy down.

Data consolidation using Columns

We sell our product via a number of different retailers. These shops send us reports of what they have sold and we need to import this into our new stock management system as a master file.
The stores do not and will not provide the data in a uniform way based on our desired template.
I therefore need a way of consolidating ranges of data that without having a unique ID for each line, with minimal manual formatting from the data importer to help save time.
http://s14.postimg.org/arslbnnxt/excelconsolidation.jpg
As you can see in the 2 examples above, nothing is in the same order and some of the supplied fields haven't been used. The column headers are static, only the data is actually pasted.
I've tried using the Excel Data consolidation tool but the SUM function just wants to add everything up or simply reports a single value, I've played with Vlookup but I then need to dedicate a number of rows to each store which results in lots of empty rows.
If you can point me in the right direction I'm more than happy to research the tool or function I need, web searches keep bringing me back to the consolidation tool.
Many thanks,
Since you say that column headers are static, you actually do have a unique ID.
The task can be accomplished by using HLOOKUP with Column headers as lookup value.
However, the formula will depend on how you organize or store input sheets from different stores.
Here I have tested a setup where each store input is pasted in consecutive sheets starting from 'Sheet1'. i.e. Store1 in Sheet1, store2 in Sheet2 ... with row 1 containing header.
Then in consolidated sheet using helper columns for identifying sheet and row number, the formulas look like this
in A2 =IFERROR(HLOOKUP(A$1,INDIRECT("Sheet"&$H2&"!A:O"),$I2,0),"")
in H3 =IFERROR(IF(INDIRECT("Sheet"&H2&"!A"&I2+1)="",H2+1,H2),"") (if no more records, increment sheet number)
in I3 =IFERROR(IF((H3-H2)=0,I2+1,2),"") (if sheet number changed, reset row number to 2)
Initial value for H2 = 1 , I2 = 2
Test file: Storefile

Pulling information from 1 worksheet to another, based on drop down list selection

I am trying to get a spreadsheet to auto populate rates for products, based on the size of the order, which are chosen from a drop-down menu.
I am using 2 workseets - Sheet 1 has a data validation drop down list of the Order Sizes (0-49, 50-99, 100+), and another column of Products, where I would like the rates to come across. Sheet 2 has 3 tables - One table per Order Size, containing the products' rates for that size order (Table 1 = 0-49, Table 2 = 50-99, Table 3 = 100+).
I can't figure out how to get the rates from the 3 tables (on Sheet 2) to pull across and auto-populate in the Products column (on Sheet 1), once I've chosen the Order Size from the drop down list (on Sheet 1).
I hope that makes sense. Unfortunately I'm too new to this site, so it won't let me post images or files
I don't really understand Macros or VBA, so please dumb it down for me :-) Thank you!
You can accomplish this without using any VBA by making use of the IF and VLOOKUP functions. I'm assuming your data looks like this:
The formula in B8 is:
=IF(B2="0-49",VLOOKUP(B5,Sheet2!A3:B5,2,FALSE),IF(B2="50-99",VLOOKUP(B5,Sheet2!A8:B10,2,FALSE),IF(B2="100+",VLOOKUP(B5,Sheet2!A13:B15,2,FALSE),"Enter a valid order size selection")))
Basically the IF statements tell it which table to look in, based on the selected order size, and the VLOOKUP statements do the looking up based on the selected product. An IF statement takes the form of:
IF(logical_test, [value_if_true], [value_if_false])
So, this first checks if the value of B2 is "0-49." If it is, it performs the lookup in the small order table. If it's not, it goes on to check if the value is "50-99." Etc. Then, at the end, if the value isn't any of the options, it prompts the user to enter a valid order size.
See:
http://office.microsoft.com/en-us/excel-help/if-function-HP010342586.aspx
http://office.microsoft.com/en-us/excel-help/vlookup-HP005209335.aspx

Resources