Tallying Unique Names per month using in cell formulas - arrays

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,"")

Related

How can I write an array formula that extracts unique values from a list only if they have a certain value in the column next to them?

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.

How to use index match (array formula) to return corresponding values from a drop down list?

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.

Define range for sum/sumif with a formula

I've been going up and down the internet to solve this. I think I am not searching with the correct parameters but I still hope you can help me.
Sample table:
I have some consolidation forms I need to fill with sums. So, in C19 (which is actually on a new tab) I would like to sum all the values C5-C12 which are mapped to the AB100 account for the consolidation, in production for example. The AB100 account is not unique to production, so I first need to define the column in which the specific row(s) have to be used to sum the values. Automating that in a formula is my key issue here.
I could easily solve this by just selecting column E as range for SUMIF but I want the formula in C19 to be able to recognize which column is to be looked at automatically, e.g. by using a "Lookup Key". I have many of those consolidation forms and I don't want to manually change the formulas on each tab.
It seems to me that all tips I found for nested SUM(IF( or SUM(INDEX( - even as array formulas - have the result value on the intersection of matched row and column. What I have on that intersection is a range of identical account numbers which need to be matched back to their respective $ values in C5-C12.
Any idea how I can do this with a formula?
Use INDEX/MATCH
=SUMIF(INDEX(D5:F12,0,MATCH(C16,D4:F4,0)),B19,C5:C12)
Using an index formula to select the column required in the SUMIFS
Hope this helps!

Create unique list of names from several sheets

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.

match, index, and concatenate to just one cell

I have a Google spreadsheet with two sheets, that I want to use to plan the calendar for my staff. One sheet is called "maquinas" (machines). The rows are the dates and the columns are the machines. Inside each cell there's the name of the operator of the machine. Like this:
Note that:
-some machines are inoperative some days (marked in black)
-there are special days when a machine that normally is operative has to close (cell H5)
-some operators have to operate several machines the same day
I have another sheet called "personas" (employees), where I want that each employee only has to look to one cell to know everything he has to do on each day (a list of all the machines that he must operate that day). This is an example of the desired result:
The order in which the machines appear in each cell is not important, as long as every one of them appears.
I have no idea about how to solve it. I have tried to bypass it creating a huge "tridimensional spreadsheet", with dates in the rows, employees in the columns, and machines in the sheets (in the third dimension), and concatenate towards the first sheet. It works, but then is very cumbersome and error-prone to make changes in the employees' daily work.
I have a bad feeling. Probably it will need code or array formulas, and the function concatenate doesn't work with arrays. And I have no idea of how to code in VBA, much less in Google Spreadsheets.
I think I have something you can try. Manually set up on your "personas" sheet,
enter the employee names in row 1 and the days in column A. Just as they are on
your example. Then paste this formula in cell B2:
=iferror(join(" ",(query(transpose(QUERY(maquinas!$B$1:$M$5 , "select * " )),"select Col1 where Col"&index(row())&" contains'"&B$1&"'"))))
Then drag the formula in B2 down as far as you need for days (If days are
not yet entered, they will show as blank.) Then highlight all the all the
cells with formulas in column B and drag it right to column J.
The "maquinas" is fine as is.
Let me know if you have a problem or need anything explained.
Here is a link to my working test spreadsheet. Make a copy and try it.
If you are using a different language, you may need to change the , to ;
in the formulas.
https://docs.google.com/spreadsheets/d/1jqDkYTy3rssqeKGJyLYzcMJ27c5X3a1P5osKkWPNOoM/edit?usp=sharing

Resources