Trying to write a function in Excel that will pull data from the larger list on the left and display a smaller list that matches criteria given. For example, I want to itemize each salespersons vehicles individually as a list under their names on the right. Is there an easy way to do this? I was thinking about generating an array based off of the sales reps name in E:E, then using =offset() to pull the vehicle model and display it under the reps name. But I can't think of a way to do this. Any pointers would be great.
Related
I have an understanding of how index/match can be used to create a unique list of items. I'm trying to create a unique list of items in a specific category and that is presenting a challenge to me.
For instance, say I have:
INDEX SPY
INDEX SPX
GOLD GLD
GOLD JNUG
GOLD GLD
INDEX SPY
and I want to extract only the unique GOLD values from the list. The output should be: GLD, JNUG.
I wrote a separate array formula to check if the left column is GOLD then output the symbol from the right column but the problem I'm having is that whatever I set for false ends up looking like it's part of the list to the index/match formula.
I was thinking that maybe there's a way to remove all zero-value array elements before exposing it to index/match but I'm out of my league here. Any suggestions on how to get the job done efficiently would be appreciated. Thank you!
Let's assume your data is in A1:B6. With UNIQUE and FILTER this is pretty easy now (Excel 2021+). Use the following in one cell, and it will spill:
=UNIQUE(FILTER($B$1:$B$6,$A$1:$A$6="GOLD"))
In earlier versions, it's a bit more work. You can use the following array formula (Ctrl+Shift+Enter to enter). Here entered into cell D3:
=IFERROR(INDEX($B$1:$B$6,MATCH(0,IF("GOLD"=$A$1:$A$6,COUNTIF($D$2:D2,$B$1:$B$6),""),0)),"")
You drag this formula down until you reach empty cells (the IFERROR() wrapper converts the #N/As that appear after all unique values have been found into ""). The "magic" is here done by IF("GOLD"=$A$1:$A$6,COUNTIF($D$2:D2,$B$1:$B$6), supplying INDEX() with new rows only for those rows that contain "GOLD" in $A$1:$A$6.
Excel Screenshot
Excel Screenshot with Formulas
I have attached photos to show an idea of what I am trying to do. Basically, I have a very large list of features that are shared between certain groups. I want to use a drop down list of the features, and then have a formula that will output the group that has the lowest cost of that feature along with the cost of that feature within the group.
(Also you will see that I purposefully ignore zero values. I do this because not every group has a certain feature and those cells default to zero).
I figured out how to get the cost of the feature to output, but I'm having trouble getting to output the group name. I am assuming there will be an array formula to do this, but I am just starting to learn those and I'm having trouble with this one.
Well you could always use the same approach you used to pull in the value, by pulling in the index of the column heading that matches the computed min, and using an offset function to match on the right row:
=+INDEX($B$1:$D$1,MATCH($B$10,OFFSET($B$1:$D$1,MATCH($A$7,$A$2:$A$4,0),0),0))
The thing is, I'm not sure how you would want to handle ties, if 2 vendors had the same price, this would match the first one in the list.
I have a list of people and dates that they were contacted. From that list, I need to pull the number of contacts per month for unique individuals. Here's an example list:
I need a formula in D:D that returns a 1 for the first instance of a date for each unique individual. I really don't want to manually type all those 1's.
I'll update this with what I come up with - I usually like to show that I've made an attempt, but I'm really not familiar with arrays at all, and I'm sure I'm going to need one here.
I appreciate the assistance, thanks.
Using your provided sample data, in cell C2 and copy down, no array needed:
=IF(COUNTIFS(A$2:A2,A2,B$2:B2,">="&DATE(YEAR(B2),MONTH(B2),1),B$2:B2,"<"&EOMONTH(B2,0)+1)=1,1,"")
Alternate:
=IF(COUNTIFS(A$2:A2,A2,B$2:B2,">="&EOMONTH(B2,-1)+1,B$2:B2,"<"&EOMONTH(B2,0)+1)=1,1,"")
I need to extract one unique list of names based on one criteria. So far, so good. However, I also need the formula to look in the correct sheet when extracting this list. Here is my formula so far:
IFERROR(INDEX(Indirect(B$2&"!$B$2:$B$30");MATCH(0;IF(ISBLANK(Indirect(B$2&"!$B$2:$B$30");COUNTIF(E$4:$E4;Indirect(B$2&"!$B$2:$B$30"));"")
My Indirect(B$2 refers to my drop down list of my departments. Hence, each department name corresponds with one sheet name. All data available that I want to extract is thus in the range $B$2:$B$30 in the desired sheet. I am not able to see why this formula fails. Apparently, I have too many arguments, but I struggle to find out where?
Edit:
Found the problem after taking a walk...! Turned out I had too few arguments. Here is the working formula:
IFERROR(INDEX(INDIRECT(B$2&"!$A$3:$A$30");MATCH(0;IF(ISBLANK(INDIRECT(B$2&"!$A$3:$A$30"));"";COUNTIF(E$4:$E4;INDIRECT(B$2&"!$A$3:$A$30")));0));"")
The observant reader may notice that I changed my array from B2:B30 to A2:A30, where my list of names actually where placed.
I have a cell that currently uses an array formula to return the name associated with the minimum hours worked for all my employees. However, what I am trying to do now is write an array formula that lists the three next employees with lowest hours. I have written a formula similar to this in the past, but can't seem to get the two formulas to appropriately match up.
My current return minimum employee formula in G5:
={INDEX(A:A,MATCH(MIN(IF(B:B=G3,IF(C:C>=$G$2,D:D)))&G3,D:D&B:B,0))}
Here is an example of my data:
...and now I'm attempting to incorporate in into the following array formula that would return a list of qualifying results as I dragged it down a column:
={(IF(ROWS(G$7:G7)<=F$8,INDEX($A$2:$A$8,SMALL(IF(Employees!$B$2:$B$8=$G$3,ROW($A$2:$A$8)-ROW($A$2)+1),ROWS(G$7:G7))),""))}
Currently, this array formula is only set up to match on position title and not the other qualifiers that I need from my minimum employee formula. How can I mesh the two formulas correctly? Thank you for any and all help and please, let me know if you need any clarification.
The ideal array result would show Boris and two blanks in consecutive rows in the Next 3 Employees chart.
Set your page up like this:
With the ranking in column F.
Then it is a quick modification of the last formula. Instead of MIN we use Small. The k part of the small equation is the ranking number:
=INDEX(A:A,MATCH(SMALL(IF(B:B=$G$3,IF(C:C>=$G$2,D:D)),F5)&$G$3,D:D&B:B,0))
This goes in G5. Is confirmed with ctrl-shift-enter. Then copied down for rows.
If do not want the errors to show then wrap it in IFERROR:
=IFERROR(INDEX(A:A,MATCH(SMALL(IF(B:B=$G$3,IF(C:C>=$G$2,D:D)),F5)&$G$3,D:D&B:B,0)),"NO MATCHES")