Highlight/extract rows that consist of a specific value - excel

Im not sure if this can be done in excel but here goes.
Im looking for a way to either extract/highlight a list of OrderID & with its related products only if the OrderID has Product "A" while ignoring the other orderID's that does not have A.
I have tried using IF statements to detect Product "A" but it could not check the subsequent OrderID rows. I also thought of using Concatenate/Textjoin but couldn't make it work.
Screenshot of sample data:
Result im trying to achieve
It should only highlights/extract the OrderID's 6613,7557 and 3396 (along with the other products values) as these OrderID's has product "A". While it ignore other OrderIDs that does not have Product "A" (eg. 4519,7601,2113,9880)
Edited: attached 2 pictures to differentiate sample and results

To highlight use below formula in conditional formatting.
=AND(ISNUMBER(MATCH($A2,$E$2:$E$10,0)),$B2="A")
If you want to filter data with Product A then use below formula.
=IFERROR(INDEX($A$1:$B$17,AGGREGATE(15,6,ROW($A$1:$A$17)/($B$1:$B$17="A"),ROW(1:1)),COLUMN(A$1)),"")
If you have Office365 then use Filter() formula.
=FILTER(A1:B17,B1:B17="A")

If you have O365:
F2: =FILTER($B$2:$C$17,COUNTIFS($B$2:$B$17,$B$2:$B$17,$C$2:$C$17,"A"))
If you have an earlier version of Excel:
=INDEX(B2:C17,
-1+AGGREGATE(
15,6,
1/COUNTIFS($B$2:$B$17,$B$2:$B$17,$C$2:$C$17,"A")*ROW(B2:B17),
ROW(INDEX($A:$A,1):INDEX($A:$A,SUM(COUNTIFS($B$2:$B$17,$B$2:$B$17,$C$2:$C$17,"A"))))),
{1,2})
Highlighting the A's can be done with simple conditional formatting (eg cell equals A)

Related

Create Custom Numbering Format Excel

I need to create a formula or custom numbering format that references the Requirement Type returns the requirement ID FR,SC, Etc and numbers the column FR001, FR002, FR003... or for SC001, SC002, SC003... for all of the requirements.
How is this possible?
In my example I created one table for the codes (insert > table) and one for your requirments. To make the formula less complicated I added a helper column for the code which uses a Index/match formula to retrieve the code based on the type. Within the ID column CountIf is used to get the "running" number".
Code =INDEX(tblCodes[Requirement],MATCH([#Type],tblCodes[RequirementType],0))
ID =[#Code] & TEXT( COUNTIF($E$3:$E3,[#Code])+1,"000")

Using VLOOKUP and not only match on first value

I'm trying to use VLOOKUP to match activities with product codes, but run into an issue since VLOOKUP always returns the first match. I did a mockup below to describe my issue. To the left, I have a table with activity names and product codes.
To the right, in column G, I want to, based on matching activity names in column F with activity names in column A, assign the activities product codes from column B.
When I use VLOOKUP, it only matches with the first activity name and give all the activities with the same name the same product codes. I need them to get different product codes even if they have the same name. I want my function to "take the next one" on the list, when the first one is taken.
Should I try to use another function to solve this? Is it impossible with VLOOKUP? My 'real' document has like 2000 rows, and the solutions I found on Youtube was not good to scale.
Thanks in advance. I'm new to here so if I should clarify my question in any way, feel free to tell me.
If the raw is around 2,000 rows, you can use a nested index match with helper columns.
Add a rank in column C with the formula =COUNTIF(A2:$A$2,A2)
Then apply the same ranking in your output part as well (Ensure Activity Name is sorted so that the formula works), Output rank formula =IF(J2=J1,I1+1,1)
Formula that lists out the Product Code {=INDEX($B$2:$B$3190,MATCH(I2,IF($A$2:$A$3190=J2,$C$2:$C$3190),0))}
This is an array formula, you get the curly brackets by hitting control+shift+Enter instead of just Enter upon keying in the formula
If you are using excel 365, you can use UNIQUE formula.
=UNIQUE(A2:B18)

Excel, using match index, and if statement

My issue is that I have an excel file. The file requires me to analyze 4 columns.
This is the data:
F is the column for the in-active and active
B is for the name being compared
G is the column with a bunch of names
H is the column with the dates
Given the status as in-active, or active, beside the city name, i am required to match it with the other city column if it is Active. If it is active, then display the date.
I tried to implement this formula:
=IF(INDEX(F:F, MATCH(B2,$G:$G))="Active",INDEX(H2:H1683, MATCH(B2,G2:G1683,0)),"n/a")
but it seems to display for active and inactive.
This was the solution
=IF(INDEX($F3:$F1684,MATCH($B3,$G3:$G1684,0))="Actual",INDEX($H2:$H1684,MATCH(B3,G2:G1683,0)))
You can use xlookup to search for multiple criteria.
=XLOOKUP("active"&B2,$F$2:$F$14&$G$2:$G$14,$H$2:$H$14,"na",0)
Or, you can use an alternative form using boolean logic:
=XLOOKUP(1,($F$2:$F$14="active")*($G$2:$G$14=B2),$H$2:$H$14)
See https://exceljet.net/formula/xlookup-with-multiple-criteria for a tutorial on searching with multiple criteria.
Use SUMIFS:
=IFERROR(1/(1/SUMIFS(H:H,F:F,"Active",G:G,C2)),"n/a")
This assumes that only one date per Name/Status combo exists.
With the new Dynamic Array formulas:
=#FILTER($H$2:$H$7,($F$2:$F$7="Active")*($G$2:$G$7=C2),"n/a")

Excel VLOOKUP with multiple possible options in table array

I have two lists, the first is a set of users. The second list contains different encounter dates for these users.
I need to identify the date that is within 10 days of the "Renew Date" [Column C], but not before. With Member 1 this would be row 3 1/8/2017. With Member 2 this would be row 6, 1/21/2017.
Now using a VLOOKUP which the user before me who managed this spreadsheet obviously isn't viable as it's simply going to pickup the first date that has a matching Member ID. Is there a way to do this in Excel at all?
I have included a link to a sample file and a screenshoit of the sample data.
https://drive.google.com/file/d/0B5kjsJZFrUgFcUFTNFBzQzN4cm8/view?usp=sharing
To avoid the slowness and complexities of array formulas, you can try with SUMIFS but the problem is that if you have more than one match, it will add them, not return the first match. The sum will look like an aberration. Will work however if you are guaranateed that you have only one match in the data.
An alternative is also to use AVERAGEIFS, which, in case of multiple matches, will give you their average and it will look like a valid date and a good result. Enter this formula in D2 and fill down the column:
D2:
=AVERAGEIFS(G:G,F:F,A2,G:G,">="&C2,G:G,"<="&C2+10)
and don't forget to format column D as Date.
Try this
=SUMPRODUCT($G$2:$G$7,--($F$2:$F$7=A2),--($G$2:$G$7<=C2+10),--($G$2:$G$7>C2))
Format the result as date. See screenshot (my system uses DMY order)
Don't use whole column references with this formula. It will slow down the workbook.

How to get formula based on current filter with EXCEL?

I have an excel file. I filtered cell according to my conditions.
I could have done this with formulas also by typing IFs.
Rather than typing this formula, is there a way to generate this formula from existing filter?
By this way, I don't have to type a lot of IF statements by hand.
Example
Let's say I filtered this table with conditions age=3 color=Black body_mark=Star
I could do this just by filtering.
However, I want to create a formula with this and just paste to cell.
By this way, I can use different conditions in different cells.
Apart from that with this formula I want to take TOTAL AGE.
SUMIF( range, criteria, [sum_range] )
If you use following formula for one criterion:
SUMIFS("B2:B17",3,"B2:B17") it will give you total age for all horses with age = 3
In your case use the following SUMIFS to to get total age with multiple criteria age = 3, colour = black...etc
SUMIFS("B2:B17","B2:B17",3,"C2:C17","Black","D2:D17","Star")
Let me explain,
Assume your B2:B17 has age listed for all horses. C2:C17 for colour and D2:D17 for body mark.
So you want to get total age satisfying conditions for all three columns. That's what the SUMIFS() does here.
Is that what you are looking for?
Take a look at this article : SumIfs() web resources for further understanding.

Resources