I have a look up table in another sheet, for a room booking system. The "ROOMS" table is simple an X-Y row with a header:
In the main data sheet, I want to look up the rooms, but highlight RED/YELLOW rooms that have already been "booked" on the same row, as another room reference.
Here we have a normal booking where both rooms are different. That's acceptable:
But here we have the same room booking on both and they are highlighted RED:
This works because I have a Conditional Format on every Room Allocation cell like this:
=OR(I2=K2,I2=Q2,I2=T2,I2=W2,I2=Z22,I2=AF2,I2=AI2,I2=AP2,I2=AS2,I2=AV2,I2=AY2,I2=BB2,I2=BE2,I2=BK2,I2=BN2,I2=BQ2,I2=BT2)
=OR(K2=I2,K2=Q2,K2=T2,K2=W2,K2=Z22,K2=AF2,K2=AK2,K2=AP2,K2=AS2,K2=AV2,K2=AY2,K2=BB2,K2=BE2,K2=BK2,K2=BN2,K2=BQ2,K2=BT2)
etc.
What I want to know, is there a way to do this using HLOOKUP on ONE row?
The reason I ask about the "one row" situation is that according to this, the table array has to be a genuine table with a header and at least one row of data.
But as you can see above, I only have ONE row to work with, which is data only.
It looks like you could use a COUNTIF on that:
=COUNTIF($2:$2,A$2)>1
Note the absolute references. That should work across all of row 2, but you can tweak it a bit if you want it to only apply to certain columns.
Related
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.
I am looking to return the intersection of a given row and column in an Excel table, where the sort/filter of the table will be changed.
I have found lots of resources on how to do a two way lookup in a static Excel 2D array/table that will never change order, but I am running into trouble trying to reference these intersections of a given row and column in a table that will be filtered and sorted by users. Filters and sorts are changing the cells' locations, breaking my references.
Ideally, the solution should look something like this:
=INDEX(TABLE,MATCH("PRODUCT",A:A,0),MATCH("COMPANY",$1:$1,0))
or, something like this,
=TABLE[[#Data],[PRODUCT] TABLE[[#All],[COMPANY]]
My environment is a table where the left most column is a list of products, and the top most row are column headers listing company names. The cell values at the intersection are quantities of products per company.
Thank you for any help, in advance!!
EDIT: Here's a visual example,
PRODUCTS COMPANY A COMPANY B
PRODUCT #1 1 2
PRODUCT #2 3 1
Referencing "COMPANY B", "PRODUCT #1" would return 2-- what's key is that the reference isn't broken by the table being filtered or sorted.
The first formula works, if made to select adjacent cell.
=INDEX(TABLE,MATCH("PRODUCT",A:A,0)-1,MATCH("COMPANY",$1:$1,0))
Revisiting later, it was selecting cell underneath the intended. Weird. Not positive why, but seems no one really took a look here. Folks at /r/Excel understood, though without any ideas as to why it picks cell below intended.
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.
I'm using Excel 365. I have a program that exports Excel files, and one field is a bunch of tags, separated by commas.
Let's say it looks something like this:
The program allows multiple tags (there's maybe 20 that could be changed in the future) to be selected as ingredients for each kind of candy. It is not a consistent number, though they seem to always be alphabetical.
I'm looking to make some kind of table by ingredient and chef, according to time, like this:
I'm trying pivot tables, but they come back with long ingredient lists, when I really want just one item per line. I also tried making an additional column for each ingredient, which searches the main column and returns yes or no based on if it's in the ingredients column. It's still not working to have a single item listed each row with pivot tables- it gets into lots of levels and sublevels that way.
It's very likely there will be more ingredients and chefs in the future, so I'm trying to stick to some pivot tables where people can push "refresh all" to get the new ones. Ideas?
If you can build your ingredients list manually and add the names across the top then you can calculate the totals using a SUMIFS formula.
=SUMIFS($F$2:$F$5,$B$2:$B$5,"*"&$A10&"*",$C$2:$C$5,B$9)
if you put the formula above in cell B10 then autofill across and down then the values will be calculated automatically.
To break it down so you understand what's going on
=SUMIFS(**$F$2:$F$5**,$B$2:$B$5,"*"&$A10&"*",$C$2:$C$5,B$9)
is the range you want to sum under the total column. It's locked using $ so it doesn't change when you autofill.
=SUMIFS($F$2:$F$5,**$B$2:$B$5**,"*"&$A10&"*",$C$2:$C$5,B$9)
The range you want to check with the tags in each cell, also locked.
=SUMIFS($F$2:$F$5,$B$2:$B$5,`"*"&$A10&"*"`,$C$2:$C$5,B$9)
The cell containing the ingredient you want to count with a star at each end to act as wildcards so it can return true when the cell contains the ingredient. The column is locked.
=SUMIFS($F$2:$F$5,**$B$2:$B$5**,"*"&$A10&"*",**$C$2:$C$5,B$9**)
last bit is the range of the chef list (locked) and the criteria above locked by row.
I can't think of a way to automate the ingredient list but hopefully the formula will help.
I have some testing data that has been run every quarter for several years.
Each table corresponds to one quarter, and has the results for four tests by office. This data is organized in Excel as follows (this is a small sample):
Using this data set, I need to fill out this summary table:
Basically, I need to look up the value in the data set that would correspond to both the row reference and column reference. For example, row reference "UK" and the column reference "Test 1A-Q217", returning "14.85" in the summary table.
I tried using an INDEX( MATCH, ( MATCH)) formula, but that didn't work. Since the tables are laid out one after another, it would just return the results of the first table instead of the reference that matched more closely further down. What would be another way to fill out the table?
My ideal way:
Use OFFSET inside a VLOOKUP to dynamically set the vlookup area. I would first modify your data set the following ways:
Change the header rows such that col A states the quarter (e.g.
"Q1-17") and the other headers just state the Test (e.g. "Test 1A").
This is not a MUST, but will make things significantly easier. If you don't want to mess with your data, you can add a col above/below yur current headers to does this for you using LEFT/RIGHT/SEARCH (see other threads for extracting sub-strings from strings)
In your output table, put test in 1 row (e.g. "Test 1A" in row 1) and date in another (e.g. Q1-17" in row 2)
Your new formula would look something like this
=VLOOKUP($A4,OFFSET($A$3:$G$14,MATCH($V1,$A$3:$A$500,0)-1,),MATCH($V$2,$A$3:$Z$3,0),0)
What is happening is that you are doing normal VLOOKUP with 2 modifications to make it more dynamic. yous set the lookup table using OFFSET and you set the column using standard MATCH approach.
You may need to make additional modifications since I have added a row to your data set.
Note: I have not tested out this formula, you may need to make minor adjustments to the formula but this should get you what you need
Alternatively, you could create named ranges for each of your data sets and have a VLOOKUP inside your main VLOOKUP that selects the correct named range to look inside of. I think this is less elegant, will take longer to set up, and and adds additional work every time you want to add another data set each quarter.