How to check if a record exists based on month and persons name (where the name is duplicated)? - excel

I have a data-set with some names and months, sample:
Name Month
Max 2
Sally 5
Max 1
James 11
Richard 9
Sally 9
I then have a table as such:
Month
Name 1 2 3 4 5 6 7 8 9 10 11 12
Max
Sally
James
Richard
How do I create a formula that can enter "Yes", or "No" for each month based on the person's name? For example, Max would have months 2 and 1 displaying "Yes", all other months displaying "No".
I can't think of how to do this...using an INDEX/MATCH function I can pull up the first month for "Max", but it won't register the second time his name shows up (it just matches the order of his name with where his data lies in the array, doesn't consider duplicates).
Is there a way to do this?
Thanks.

Assuming a data setup like this:
In cell E3 and copied over and down is this formula:
=IF(COUNTIFS($A$2:$A$7,$D3,$B$2:$B$7,E$2),"Yes","No")

Related

Is there a way to find the closest row match based on a different row match?

I'm working with a data in which there are multiple sets of information in the same column. This is making it difficult to pick out the data I need as it always returns the first result. I am trying to find a way to ensure that the column result returned in a search is based on a different column's value. For example:
Name/Date
01/01/2022
02/01/2022
03/01/2022
04/01/2022
05/01/2022
Bob
1
7
2
6
1
Jane
1
7
9
3
1
Jimmy
8
7
5
4
2
Robin
1
2
9
6
2
Batman
4
7
6
6
8
06/01/2022
07/01/2022
08/01/2022
09/01/2022
10/01/2022
Bob
4
1
4
2
12
Jane
6
21
9
3
1
Jimmy
8
2
5
4
2
Robin
8
5
0
6
2
Batman
5
5
6
6
8
If I wanted to yield the number for Jane on 07/01/2022 (which is 21), is there any way of returning this? I've been able to use =MATCH to pull the correct column based on the date search criteria, but I cannot see a viable way of pulling for a particular person when their name appears multiple times in the same column. Attempting a lookup will return the first result for the name hit (so in the case of my Jane example, it would return row 3 instead of 9). I'm looking to be able to enter a name and a date, and it returns the result from that part of the array.
Is such a thing possible, please? If not, is there any workaround that may help to provide me the same result?
Thanks in advance for your assistance!
This is being attempting in Office 365.
Assuming:
ms365 (specifically access to the BETA-channel);
Equal intervals with the same names at the same postions;
Formula in I4:
=LET(X,WRAPCOLS(TOCOL(B1:F12,,1),6),SUM((A1:A6=I3)*FILTER(X,TAKE(X,1)=I2)))
Assuming your data starts in row 1
A1:F12 - data range
B17 - Jane
B18 - 07/01/2022
=LET(data,A1:F12,names,A1:A12,lookupname,B17,lookupdate,B18,INDEX(data,MIN(LET(rowlist,IF(names=lookupname,ROW(names),0),IF(rowlist>MAX(IF(data=lookupdate,ROW(data),0)),rowlist,""))),MAX(IF(data=lookupdate,COLUMN(data),0))))

How to combine SUMPRODUCT with an INDEX and MATCH formula?

Note, I have edited my original question to clarify my problem:
As the title suggests, I am looking for a way to combine the SUMPRODUCT functionalities with an INDEX and MATCH formula, but if a better approach exists to help solve the problem below I am also open to it.
In the below example, imagine that the tables are on different sheets. I have a report that has the sales of each ID in the rows and each month in the columns (first table). Unfortunately, the report only has IDs and not the region they belong to, but I do have a look up table which labels each ID with their respective region (second table):
A
B
C
D
1
ID
January
February
March
2
1
10
5
20
3
3
5
5
10
4
7
0
10
5
5
14
10
25
5
6
25
5
10
10
7
27
10
10
10
8
44
5
5
5
A
B
1
ID
Region
2
1
East
3
3
East
4
7
Central
5
14
Central
6
25
Central
7
27
West
8
44
West
My goal is to be able to aggregate the sales by region as per the result below. However I would only like to show sales data that belong to the month that is shown in cell D2.
Goal:
A
B
C
D
1
Region
Sales
February
2
East
10
3
Central
45
4
West
15
I have used the INDEX and MATCH combination to return a single value, but not sure how I can return multiple values with it and aggregate them at the same time. Any insight would be appreciated!
You may just use:
=SUMPRODUCT((Sheet1!B$1:D$1=D$1)*(Sheet1!H$2:H$8=A2),Sheet1!B2:D8)
Remember, SUMPRODUCT() could be quite heavy processing huge data, therefor to combine INDEX() and MATCH() is not a bad idea, but let's do it the other way around and nest the latter two into SUMPRODUCT() instead =):
=SUMPRODUCT(INDEX(Sheet1!B$2:D$8,0,MATCH(D$2,Sheet1!B$1:D$1,0))*(Sheet1!H$2:H$8=A2))
Another option using SUMIF+INDEX+MATCH function as in
In "Sheet2" B2, copied down :
=SUMIF(Sheet1!H:H,A2,INDEX(Sheet1!B$1:D$1,MATCH(D$2,Sheet1!B$1:D$1,0)))

Sum of Vlookups advice

I have a column "Uni"
E.g.
Person Uni Round 1 Round 2 Total Rank
Leia Notts 5 5 10
Hailey Notts 6 5 11
Bobby Bath 8 1 9
James Liverpool 9 1 10
Then another table:
University Total Score Rank
Notts =sum(vlookup(...))
Bath =sum(vlookup(...))
Currently, my formula returns the 'first' lookup of the keyword - e.g. for notts, it returns '10' - rather than looking up the 10 and the 11 and summing them.
How do I make it lookup and sum both values?
My current formula is =sum(vlookup(S7,B$3:Q$40,15,FALSE)) where S7 is "Notts", range, index column 15 is "total score"
There's about 8-10 of each university.
Vlookup only returns one value, you can't sum over that.
Maybe use instead something like
=SUMIF(B$3:B$40,S7,$P3:$P40)

Excel to find value from one sheet & show to another sheet

I have a sheet1 where column A= employees name & column B=Status (present, absent, etc), I prepare Daily attendance in each sheets, so I have 31 sheets in a month. Now I have a new sheet November. in this sheet column A is employees name and column B, C, D, etc for each days status. show me status of each employes in each days B, C, etc
You would use the VLOOKUP statement to fetch the status from the other sheets.
This is in the format:
vlookup([cell which has the value you want to lookup], [range of cells which contain the table], [column you want to return from that table]). Hopefully this is explained in the example below:
For ease of explanation, imagine your sheets are named Nov1, Nov2... Nov29, Nov30 and NOVEMBER.
Nov1:
A B
1 Employee Name Status
2 Albert Present
3 Brian Absent
4 Catherine Present
5 David Present
6 Edward Present
Nov2:
A B
1 Employee Name Status
2 Albert Absent
3 Brian Absent
4 Catherine Present
5 David Absent
6 Edward Absent
Then, in your sheet NOVEMBER, which is the month summary, use the formulae:
A B C
1 Employee Name Nov 1st Nov 2nd
2 Albert =VLOOKUP($A2,Nov1!$A$2:$B$6,2) =VLOOKUP($A2,Nov2!$A$2:$B$6,2)
3 Brian =VLOOKUP($A3,Nov1!$A$2:$B$6,2) =VLOOKUP($A3,Nov2!$A$2:$B$6,2)
4 Catherine =VLOOKUP($A4,Nov1!$A$2:$B$6,2) =VLOOKUP($A4,Nov2!$A$2:$B$6,2)
5 David =VLOOKUP($A5,Nov1!$A$2:$B$6,2) =VLOOKUP($A5,Nov2!$A$2:$B$6,2)
6 Edward =VLOOKUP($A6,Nov1!$A$2:$B$6,2) =VLOOKUP($A6,Nov2!$A$2:$B$6,2)
Using the $ symbol will mean you can copy down the column and the formulae will update automatically. Ensure that the list of employees in your separate daily sheets are in alphabetical order.
So this should result in something like this:
A B C
1 Employee Name Nov 1st Nov 2nd
2 Albert Present Absent
3 Brian Absent Absent
4 Catherine Present Present
5 David Present Absent
6 Edward Present Absent

Count names one time (per year) regardless of how many there are by year

The problem is:
There is a table that gets data added to it each month. I use this data for many different pivot tables and reports, so I am not able to modify it. The user has requested that if its possible (and I assured him that it was) he would like to see two (2) single values of This Year and Last Year Doctors on the list.
The data looks something like this:
Doctor, In/Out, Date, Number
John Deaux Out 10/1/11 8
John Deaux Out 11/1/11 3
John Deaux Out 01/1/12 5
John Deaux Out 05/1/12 3
John Deaux Out 09/1/12 1
Billy White In 02/1/12 2
Mike Adams Out 06/1/11 6
Mike Adams Out 10/1/11 9
Mike Adams Out 01/1/12 1
Mike Adams Out 04/1/12 6
I would have 1 John Deaux for 2011, and 1 for 2012. The same for Mike Adams.
TY 2
LY 2
Now I only have to count the "Out"(s), so I have to be careful of that. Also, there is the chance that I would have to build this for the previous 12 months as well making it that much harder.
1 for John Deaux for the previous 12 months.
TY 2
LY 1
*TY: This Year - LY: Last Year
To do this manually:
Since you can't make any edits to the existing table, copy everything to a new table.
In the new table, add a column called Year. Use the Year() function to get the year out of the date cell.
Make another column called Count. Use If(A2="Out",1,0) where A2 is the cell in the In/Out column.
Copy the Doctor, Year, and Count columns to a new table.
Excel 2007 and above has a convenient tool called Remove Duplicates in the Data ribbon. Use that to remove the duplicates. This will keep you from counting a single doctor twice in the same year.
Create a pivot table, using Doctor as the row, Year as the column, and sum(count) for the value.
Check this, this will check the B column for the year 2012/2013 and count the distinct unique values in column A.
=SUM(IF(FREQUENCY(IF(YEAR(B1:B11)=2013;A1:A11);A1:A11)>0;1)) + CONTROL + SHIFT + ENTER
=SUM(IF(FREQUENCY(IF(YEAR(B1:B11)=2012;A1:A11);A1:A11)>0;1)) + CONTROL + SHIFT + ENTER

Resources