Sum and recurrence for columns - excel

i have 3 columns: A has names, B has numbers, C has names. I want to see how many times MIKE and JANE appears in the table and how many times they met. The order of the columns is not fixed so i can modify the order of the columns (the names to be in columns A and B and the numbers in C) . Any help is welcomed.
-------------------------------------------------------------
| A | B | C | D | E | F | G | H |
-------------------------------------------------------------
| TRAINER|HOURS| CHILD | |TRAINER| CHILD |HOURS|MEETINGS|
-------------------------------------------------------------
| MIKE | 2 | JANE | | MIKE | JANE | 10 | 2 |
-------------------------------------------------------------
| MIKE | 5 | STEVE | | MIKE | STEVE | 7 | 2 |
-------------------------------------------------------------
| HARRY | 3 | JANE | | HARRY | JANE | 3 | 1 |
-------------------------------------------------------------
| MIKE | 8 | JANE | | HARRY | STEVE | 7 | 1 |
-------------------------------------------------------------
| MIKE | 2 | STEVE | | | | | |
-------------------------------------------------------------
| HARRY | 7 | STEVE | | | | | |
-------------------------------------------------------------

I am going to suggest a SUMPRODUCT option. As other have mentioned there is also the SUMIF option.
=SUMPRODUCT(($A$2:$A$7=$E2)*($C$2:$C$7=$F2)*$B$2:$B$7)
If you move your C column to B update the ranges in the formula accordingly.
Now the better option as other have suggested is:
=SUMIFS($B$2:$B$7,$A$2:$A$7,$E2,$C$2:$C$7,$F2)
And I totally missed that you were looking for the number of meetings as opposed to the hours. We can again use SUMPRODUCT with one less term or we can use COUNTIFS.
=SUMPRODUCT(($A$2:$A$7=$E2)*($C$2:$C$7=$F2))
and the COUNTIFS method is
=SUMIFS($A$2:$A$7,$E2,$C$2:$C$7,$F2)

Related

Excel In cell formula Number of surveys administered

Good Afternoon,
I have an excel sheet that records encounters with community residents by name and date. During each encounter a brief survey is also administered. I want to track changes to these survey questions by name over time. Is there any way to do this with in cell formulas? Here's an example of the table I have in mind:
| Name | Date | Q1 | Q2 | Stress | Survey Number |
| | | | | | (calculated) |
|--------------|------------------|----|----|--------|---------------|
| Steve Rogers | 5/1/2018 | y | y | 5 | 1 |
| Steve Rogers | 5/2/2018 | y | y | 6 | 2 |
| Tony Stark | 5/1/2018 | n | n | 10 | 1 |
| Nick Fury | 5/1/2018 | n | y | 8 | 1 |
| Nick Fury | 5/2/2018 | y | y | 5 | 2 |
| Tony Stark | 5/2/2018 | y | n | 8 | 2 |
| Tony Stark | 5/3/2018 | n | n | 4 | 3 |
I want to calculate the survey number by referencing the name and the date. I have no idea where to start, honestly. Is this even possible using an in-cell reference?
Use COUNTIFS()
=COUNTIFS(A:A,A2,B:B,"<=" & B2)
Put that in F2 and copy/drag down.

Excel to return list of items with specific repetition

I am trying to create a list of names that repeat a specific number of times, based on another variable. Basically, if I have the following:
Column A Column B
Amy 5
John 2
Carl 3
the result would be:
Amy
Amy
Amy
Amy
Amy
Carl
Carl
Carl
John
John
I have built the initial list using the Index-Small-Countif, method, to get an alphabetical and distinct list, and then another formula to determine how many times each item repeats. I know I need to use some sort of index/offset with reference to rows, but just can't quite get it to work out.
The list is dynamic and changes daily, so manually retyping the list each day would result in too much human error and time (list is about 50 distinct items, with total number of rows at the end being around 400). Ultimately, the list will be used for a number of sumproduct/vlookups.
I can do this fairly quickly in VBA, but the users of this document don't always trust VBA and trying to get them to Enable Macros each time is not something that is going to work.
Thank you very much for any help you can offer!
Based on your table:
+---+------+---+
| | A | B |
+---+------+---+
| 1 | Amy | 5 |
| 2 | John | 2 |
| 3 | Carl | 3 |
+---+------+---+
In column C stick a "0" at C4 and formula =B1+C2 copying down to just before the 0:
+---+------+---+----+
| | A | B | C |
+---+------+---+----+
| 1 | Amy | 5 | 10 |
| 2 | John | 2 | 5 |
| 3 | Carl | 3 | 3 |
| 4 | | | 0 |
+---+------+---+----+
Now we have an upper bound of the row that each value should be placed on which we can use in a Match() formula which will feed an Index() formula.
In a new column (I'm using E) IN E1: =INDEX($A$1:$A$3,MATCH(ROW(),$C$1:$C$3,-1),1) and copy down
+----+------+---+----+--+------+
| | A | B | C | D | E |
+----+------+---+----+--+------+
| 1 | Amy | 5 | 10 | | Carl |
| 2 | John | 2 | 5 | | Carl |
| 3 | Carl | 3 | 3 | | Carl |
| 4 | | | 0 | | John |
| 5 | | | | | John |
| 6 | | | | | Amy |
| 7 | | | | | Amy |
| 8 | | | | | Amy |
| 9 | | | | | Amy |
| 10 | | | | | Amy |
+----+------+---+----+--+------+
The list is backwards because of that oddball backwards from 0 thing we did in Column C. This is to make that Match() last parameter of -1 (Greater than) work correctly.
I would imagine with some tweaking this could be done a little cleaner, but this should get you in the ballpark.
Although I would still be a big proponent of finding users who are capable of enabling macros. Ugh.

excel: filter using formulas

I have a list of people who belong to two groups (A or B). I want to create a column which lists all the people who belong to group A.
I have been trying to come up with an array formula but I do not have a working example. Any help appreciated!
Names | Group | Desired Output
Bob | A | Bob
Fred | B | Eric
Matt | B | Dave
Eric | A | Fred
Dave | A |
Stew | B |
Fred | A |
Many Thanks in advance
Normal formula for column C:
C2=
=IFERROR(INDEX(A:A,AGGREGATE(15,6,ROW(B:B)/(B:B="A"),ROW()-1)), "")
Copy/paste down in column C for a sufficient number of cells.
Array formula: select a sufficient number of cells in column C and write the same formula in the formula bar then press Ctrl+Shift+Enter
From this
+---+-------+-------+
| | A | B |
+---+-------+-------+
| 1 | Name | Group |
| 2 | Nick | A |
| 3 | Marc | A |
| 4 | Manny | B |
| 5 | Luck | A |
+---+-------+-------+
you can create two pivot tables with Name in the row label and Group in the filter data.
Then you can filter only people depending on the group.
+---+-------------------+---+
| | A | B |
+---+-------------------+---+
| 1 | Group | A |
| 2 | | |
| 3 | Etichette di riga | |
| 4 | Luck | |
| 5 | Marc | |
| 6 | Nick | |
+---+-------------------+---+
So if your data is in range A1:B7 this would be the formula:
=IFERROR(INDEX($A$1:$A$7,SMALL(IF($B$1:$B$7="A",ROW($A$1:$A$7)-ROW($A$1)+1),ROWS($A$1:A1))),"")
This is array formula that is applied with Ctrl + Shift + Enter and you will need to drag it down.

INDEX MATCH - List with excel formula based on multiple criteria

I need some help listing the opperations that meet a couple of criterias.
My dataset is pretty much like the following example:
A B C D
-----------------------------------------
1 | Opp_num | Seller_1 | Seller_2 | Aux |
-----------------------------------------
2 | 7001 | John | Tom | 1 |
3 | 7002 | Carl | John | 0 |
4 | 7003 | Mary | John | 1 |
5 | 7004 | Tom | Mary | 0 |
6 | 7005 | John | Tom | 0 |
7 | 7006 | John | Mary | 1 |
-----------------------------------------
What I really need is to list all the operations where "John" appears either in column "seller_1" or "seller_2", and also column "Aux" is equal to 1.
In this example the listed operations should be:
7001
7003
7006
I have tried a couple of things with no success.
Thanks in advance for your help!
MD
=IF(AND(D2=1,OR(C2="John",B2="John")),A2,"")
Here it is. Paste it in the cell.

Excel - Return multiple matching values from a column matching two variables, horizontally in one row

I have this table:
| | A | B | C |
|---|---------|--------|---|
| 1 | | | |
| 2 | Oranges | Red | 1 |
| 3 | Apples | Yellow | 2 |
| 4 | Grapes | Orange | 3 |
| 5 | Oranges | Orange | 4 |
| 6 | Apples | Red | 5 |
| 7 | Grapes | Green | 6 |
| 8 | Apples | Green | 7 |
I want to check for matching values in Column A like Apples,Yellow , Apples,Green, etc... and return all the corresponding values from Column B in one row:
I tried to nest AND into IF but didn't work out as it wasn't returning any values at all.
| | A | B | C | D | E |
|----|---------|-------------|---|---|---|
| 11 | Apples | Green | 1 | | |
| 12 | Oranges | YellowGreen | 2 | | |
My code:
=INDEX($B$2:$B$8, SMALL(IF($A$11=$A$2:$A$8, ROW($A$2:$A$8)-ROW($A$2)+1), COLUMN(A1)))
How do I get this formula to look at two variables to match?
Thank you.
You seem to be using an array formula, wouldn't concatenating work?
{=INDEX($C$2:$C$8, SMALL(IF($A11&" "&$B11=$A$2:$A$8&" "&$B$2:$B$8, ROW($A$2:$A$8)-ROW($A$2)+1), COLUMN(A1)))}

Resources