Alright I have a bit of a weird problem:
I have a store, that sells Cookies, Cakes and Wine.
I also have a report on excel for what products were sold in a day. Looks something like this:
| ID | Product Name | Quantity Sold |
| --- |--- | --- |
| Cookies| | |
| 1 |Ginderbread | 2 |
| 2 |Chocolate chip| 5 |
| 3 |Cookie type C | 1|
| Cakes | | |
From this report my goal is to get a table looking like this:
| ID | Name | Quantity Sold | Category |
| --- |--- | --- | --- |
All I need to do is get the Category from above the records, to inside the records.
However, there's 1 restriction: I can't manually enter the Category. I must use some formula to find out what the category is.
1 idea I have thought of is to use a VLookup with the range being from the first row to the current row. But having trouble figuring out making it search for "Cookies", "Cakes" and "Wine" all at once then returning whichever it finds first (from bottom up)
Should be noted neither Product Name or ID are unique keys. Yes, I hate it as much as you do.
Assuming all your ID's are unique:
For the ID column:
=FILTER(A:A,ISNUMBER(A:A))
For the Name column:
=VLOOKUP(E2,$A:$S,2) (and fill down)
For the Category Column:
=LET(x,FILTER($A$1:INDEX($A:$A,MATCH(E2,$A:$A,0)),$A$2:INDEX($A:$A,1+MATCH(E2,$A:$A,0))="ID"),y,COUNTA(x),INDEX(x,y))
(and fill down)
To return the category
MATCH the Id number to get the last row number to check in the first column
Create a filter that only returns the row which says ID
Use that filter criteria against a range that is offset by one (up) which will return an array of just the categories
Return the last item in that array
Related
My data looks like below. I have Groups that I share topics each day. We do this randomly based on need.
| | Topic 1 | Topic 2 | Topic 3 | Topic 4 | Topic 5 | Topic 6 | Topic 7 | Topic 8 | Topic 9 |
|---------|---------|---------|---------|---------|---------|---------|---------|---------|---------|
| Group 1 | | 19-apr | 30-apr | | | | | | |
| Group 2 | 18-apr | 25-apr | | | | | | | |
| Group 3 | | | | | 19-apr | 30-apr | | | |
| Group 4 | 18-apr | 25-apr | | | | | | | |
| Group 5 | | | | | | | 19-apr | 30-apr | |
| Group 6 | | | 25-apr | | | | | | |
| Group 7 | 18-apr | 25-apr | | | | | | | |
For our metrics & analysis, we need a list of groups per date on a different sheet. We like to know which all groups were engaged a given day. Like below
Can somebody please help me how I can get this done with only using formulas and without macros?
I believe this can somehow be handled on Index Matching or look-ups.
You could definitely do this with macros. You can do something similar without macros; it may not be precisely what you were looking for because it will leave blank space where groups were not addressed.
Method 1
Here is the formula I used and a picture of the sheet it is in:
=IF(IFERROR(MATCH(L$4,$B6:$H6,0),FALSE),INDEX($B$5:$B$13,MATCH($K5,$B$5:$B$13,0),1),"")
The idea is that if you have absolute references alongside your list of groups per date, then you can use index and match to fill in that group's name, but only if Match finds that precise date code in that group's row from the previous table. If you place an equivalent formula in the first cell, you can drag it out to the rest of the array.
The formula I used is not the only way to do this, but if you know Index and Match, then it should make sense to you.
Method 2
A more convoluted method would be to use image references. With these, it is possible to make the report precisely what you asked for on a separate sheet.
Suppose you took Method 1 and separated each column out into a different table. Nearly the same formula inside the cells below the date heading, except that you enclose the heading reference in int() as shown below. Create one table for each of N dates, where N is the number of days you want to monitor at once. Then when you want the summary to show you different dates, you go to each table and change the heading, and filter out blanks.
formula:
=IF(IFERROR(MATCH(INT($L$2),$B4:$H4,1),FALSE),INDEX($B$4:$B$11,MATCH($K3,$B$4:$B$11,1),0),"")
The below image shows what I mean by one table for each date:
Then you insert an image. Doesn't matter what image; could be a screenshot of anything. Click on that image, then click into the formula bar. Then highlight the table column you want it to represent. Below is a screenshot of how to to that:
Now place that picture on its own sheet in the workbook. Place each date table on its own sheet in the workbook. The reason you do this is: if you filter a table, everything else overlapping the filtered rows outside the table will also be hidden. You move tables to separate sheets to prevent them from hiding each other.
Finally, arrange your pictures into the order you like, filter the blanks out of the tables, and your images will be exactly what you were looking for:
Again, this is a little convoluted because if you want the report to show you new date summaries, you would have to change the headings on every table. Then you would have to go to each table and refresh it's filter. This is where macros usually come in.
Assume range A1:J8 housed your Source table, and L1:P8 housed the Date/Group Output
1] In L2, copied across :
=IFERROR(1/(1/AGGREGATE(15,6,$B$2:$J$8/($B$2:$J$8>K$2),1)),"")
2] In L3, copied across to P3 and all copied down :
=IF(L$2="","",IFERROR(INDEX($A:$A,AGGREGATE(15,6,ROW($A$2:$A$8)/($B$2:$J$8=L$2),ROW(A1))),""))
You can use the following formula to get a list of dates from a table:
=IFERROR(AGGREGATE(15,6,($B$2:$J$8/($B$2:$J$8*(COUNTIF($A$15:A15,$B$2:$J$8)=0)))*$B$2:$J$8,1),"")
To get a list of groups by date, use the following:
=IFERROR(INDEX($A$1:$A$8,AGGREGATE(15,6,(1/(B$15=$B$1:$J$8))*ROW($B$1:$J$8),ROW(A1))),"")
I have a spreadsheet of transactions with unique IDs.
For each transaction, there may be two rows corresponding---one initiating, one fulfilling.
As new information keeps flowing in, I want to find the initiating rows if the current row is a fulfilling. Since they will have different IDs, the only way to match them is by the amount, type, account number, and transaction date.
Each of the criteria are not unique. For example, there may be many transactions with amount of $500.
As a result, I want to write a formula that returns the transaction ID if and only if all these criteria match a row in the spreadsheet.
I tried to work with arrays thinking i can multiply them since they will be either 0 or 1 and the product will only be 1 if all criteria match, but could not get it to work since it will just return one value, instead of an array of values.
So the spreadsheet has the following structure:
ID | Account Number | Transaction Date | Amount | Customer | Fulfilling order ID? |
1 | 123456 | 06/26/2018 | 50 | John | |
2 | 123457 | 07/25/2018 | 55 | Steve | |
3 | 123456 | 06/26/2019 | 50 | John | 1 |
4 | 124588 | 07/25/2019 | 75 | Rich | |
5 | 125589 | 08/01/2019 | 80 | Vincent| |
I want to be able to write something that will return 1, on order ID 3, since it is fulfilling order ID 1.
You can certainly use dynamic ranges within array formulas, so you don't have to manually keep changing ranges when you enter data.
Something in cell F2 along the lines of:
=INDEX(A:A,MATCH(1,($B$1:INDEX(B:B,COUNTA(B:B))=B2)*($C$1:INDEX(C:C,COUNTA(C:C))=C2)*($D$1:INDEX(D:D,COUNTA(D:D))=D2)*($E$1:INDEX(E:E,COUNTA(E:E))=E2),0))
Entered as array through CtrlShiftEnter, wouldnt work?
Note
In your example it would never return a 1, but just a 3 simply because the criteria don't match (column c, dates are different). As soon as they are the same, the formula works.
I have 3 columns, the first column has data in it, against which the second one has some data.
Now I need to get a list of all the items in the first column in the third column.
The sheet as as below
Name | QTY | ACTIVE
----------------------
Apple | |
----------------------
Oranges | 10 |
----------------------
Pears | 5 |
----------------------
Plums | |
It needs to look like this
Name | QTY | ACTIVE
----------------------
Apple | | Oranges
----------------------
Oranges | 10 | Pears
----------------------
Pears | 5 |
----------------------
Plums | |
How can I do this either using a formula or a script.
What i've put above is just an example, its actually a long list of items against which there may or may not be quantities, therefore I only need a list of the items with quantities against them.
Thanks in advance.
if your using google sheets then you can use a filter function. Enter the formula and all the results will be listed in the cells below. Only items from column A that have data in Column B will be displayed.
=filter(A2:A,NOT(ISBLANK(B2:B)))
How it works
=filter(range,criteria)
You can also pull both the Name and Quantity by widening your range to include column B
=filter(A2:B,NOT(ISBLANK(B2:B)))
Note: If you get a #REF! error then you may not have left enough blank cells below your filter cell for the results to be displayed.
https://support.google.com/docs/answer/3093197?hl=en
I have a list of user's attributes nearly 10,000 long. Each user has multiple attributes, based on their department and job code. Looks a little something like this:
| USER | DEPT | JOB | ATTRIBUTE |
| User A | Dept 1 | Job 1 | Attribute 2 |
| User A | Dept 1 | Job 1 | Attribute 3 |
| User B | Dept 2 | Job 1 | Attribute 1 |
| User B | Dept 2 | Job 1 | Attribute 2 |
| User C | Dept 1 | Job 2 | Attribute 3 |
| User C | Dept 1 | Job 2 | Attribute 4 |
| User C | Dept 1 | Job 2 | Attribute 5 |
| User C | Dept 1 | Job 2 | Attribute 6 |
Where "Job 1" can have different attributes based on which department job 1 is in. I also have a pivot table in a different workbook that defines which attributes a job code should have for each department. I need a formula that will take the attribute in the row, and compare it to the pivot table to see if that attribute is associate with that department and job code combination.
EDIT
I am no longer using a pivot table, and have taken all information from the pivot table and populated the worksheet (so there is a data entry for every column in the row.
I have taken the suggested formula and updated to reflect my page titles, however I only receive back "Not associated for everything.
=IFERROR(INDEX('Roles'!C:C,MATCH(B2&C2&D2,'Roles'!A:A&'Roles'!B:B&'Roles'!C:C,0)),"Not Associated")
If I understand correctly, this is checking to confirm there is a match of B2 in column A of Roles, a match of C2 in column B of Roles and a match of D2 in Column c of Roles. If that is correct, there is a match for each, but am still returning Not Associated.
Assuming your pivot table is Worksheet PivotTable starting in column A with the following fields
Dept | Job | Attribute
and your referenced data is in columns A:D of the current sheet use this formula:
=IfError(Index(PivotTable!C:C,Match(A2&B2&C2,PivotTable!A:A&PivotTable!B:B&PivotTable!C:C,0),"Not Associated")
This will return "Not Associated" if the attribute is not associated witht the Dept and Job, or will return the attribute if it is associated.
What I am Trying to do is
lets say I have a excel sheet with
rows
ProductNo | Product | Sku | Price | Image | Thumb
25 | Shirt Blue | 4251 | $10 | shirt.jpg | shirtthumb.jpg
2 | Shirt Green | 4581 | $17 | green.jpg | greenthumb.jpg
8 | Shirt Black | 4561 | $15 | black.jpg | blackthumb.jpg
and just in different rows or on another excel sheet
ProductNo | Product | Sku | Price | Image | Thumb
25 | Shirt Blue | 4251 | $52 | |
2 | Shirt Green | 4581 | $42 | |
8 | Shirt Black | 4561 | $65 | |
How can i change the first table to update if the the second table or sheet columns data is different on specified columns and if the cells are empty forget about them ignore them and just replace the values from the second table onto the first
Final would be
ProductNo | Product | Sku | Price | Image | Thumb
25 | Shirt Blue | 4251 | $52 | shirt.jpg | shirtthumb.jpg
2 | Shirt Green | 4581 | $42 | green.jpg | greenthumb.jpg
8 | Shirt Black | 4561 | $65 | black.jpg | blackthumb.jpg
I have tried a couple of excel functions but they do not work since i have so many products to be doing cell additions
I tried doing in Vl but got confused and macro i dont even know what it is
Im open to whatever visual, functions just as long as i can perform the task
if anybody know hos let me know
Thank You
in stead of having the fixed values I propose you use a permanent formula in the specified columns.
Now to do this I would use a VLOOKUP() function. I am assuming that your ProductNo is the element that never changes therefore all the other columns will get a VLOOKUP() function.
Now if I understand correctly you MIGHT have an update in the 2nd table for the 1st table, but any empty cells in the 2nd table should be ignored.
I am also assuming you wish to see when an element will change because of the update therefore I propose the following:
In the first table add for the block of columns elements that might need an update: 2 blocks of columns, the first with the result of combining (the COMB-block) and the second with lookups from the 2nd table (the LOOKUP-block). For convenience of explaining I put the two tables in the same workbook on the sheets called table1 and table2
ProductNo | Product | Sku | Price | Image | Thumb | Product_comb | Sku_comb | Price_comb | Image_comb | Thumb_comb | Product_lookup | Sku_lookup | Price_lookup | Image_lookup | Thumb_lookup
Now start with formulas in the LOOKUP-block, use VLOOKUP(), such as this one for the *Product_vlookup* column:
=IFERROR(VLOOKUP($A2,table2!$A:B,COLUMNS(table2!$A:B),FALSE),"")
The IFERROR is for the case the product in table1 cannot be found in table2
For the formulas in the COMB-block the following will prefer the table 2 result over the table 1 result. As VLOOKUP of a matching ProductNo with an empty Element (for example for the Image) will result in a 0 (zero) returned all zeroes are regarded false lookup results as well. This is the script for the *Product_comb* column:
=IF(OR(ISBLANK(L2),L2=0),B2,L2)
As a final step to identify the products that changed you can either add a column that compared the original value with the _comb value:
=AND(B2=G2,C2=H2,D2=I2,E2=J2,F2=K2) (this returns true for no changed columns and false for any changed column)
Or use conditional formatting on each element separately or on the combination as the AND() formula shows.
As a final step in your process of updating you could copy all records from the COMB-block and paste it over the original elements.
If you have any further questions please ask.