Find how many times a number appear in a column between date range - excel-formula

In sheet1 A3:A100 I have Students ID numbers. In sheet1 B3:B100 I have dates
Now i want to put an ID and start date and end date in cells on another sheet and reflect the number of times the ID appear in the date range. Thanks

You can use COUNTIFS to count them:
=COUNTIFS(Sheet1!A3:A100,A2,Sheet1!B3:B100,">="&B2,Sheet1!B3:B100,"<="&C2)
Where:
A2 is the student ID
B2 is the start date
C3 is the end date
example sheet

Related

Auto populating calendars in excel

I have a list of project IDs with start and end dates listed by the numbered day and month. (EX august =8, 1st =1) I have a calendar on another sheet with the month and day numbers in their own cells. I want the project ID to populate in the cell where the month and day numbers on the two sheets match.
Example = if A1 + A2 on Sheet1 Match A1 & A2 on Sheet2, Populate The Project ID here.
Can someone help me figure out the easiest way to do this?
If you have a data like this (in Sheet 1 for this example):
You can use this array formula (don't forget to press Ctrl+Shift+Enter) to populate the ID when the day and month number match:
=INDEX(Sheet1!$A$1:$A$6,MAX((A2=Sheet1!$B$2:$B$6)*(B2=Sheet1!$C$2:$C$6)*ROW(Sheet1!$B$2:$B$6)))
The brackets at the beginning and end of the formula is because it's an array formula.
I let you an example here: https://docs.google.com/spreadsheets/d/1xVmoZ8cGURuwnYF8AsLkozWUIxc5nPmt/edit?usp=sharing&ouid=109997475435544900987&rtpof=true&sd=true

SUMPRODUCT with 3 criterias including date

I've been trying to come up with a formula to sum a specific amount.
It has 3 criterias: 1st is an account number: column A; 2nd is a Cost Center number: column C; and 3rd is a date from line i1 to T1 (eg.:i1= jan/2020; t1=dez/2020).
The dates are formated with "date" type: mar/12 on both sheets.
The date on the formula refers to a specific cell $F$2 in order for me to just comeback there, type the month that i want and it automatically calculates the values while taking into account the other criterias.
This is the formula i adapted from some research.
=SUMPRODUCT(Sheet2!$A:$A=Sheet1!$C20)*(Sheet2!$C:$C=Sheet1!$H3)*(Sheet2!$I$1:$T$1=Sheet1!$F2)*(Sheet2!$I$2:$T$635)
This formula currently gives back 0 instead of the value pretended (which is ~631)
Here are 2 prntscreens as form of sample, i hope it helps.
Sheet1 with formula
Sheet2
Thank you.

Find row when Cumulative sum reaches certain value with condition #2

This question is based on the answer provided in the thread linked below. I have the same question byt my data is ordered a bit different.
Find row when Cumulative sum reaches certain value with condition
In sheet1 I have columns ID, COST and Profitability Date. (ABC)
In sheet2 I have a date row (ex 201801) running horizontally starting in B1 (B1,C1 etc..). Starting in A2 i have the different ID's running vertically. The Revenue for each ID follows beneath the date row.
I would like to have the formula in Profitability Date (sheet1 column C) to return the date (sheet2 row 1) when the cost (sheet1 column B) is >= than the revenue in sheet2.
Enter the following array formula in C2, confirm with CONTROL+SHIFT+ENTER, and copy down:
=INDEX(Sheet2!$B$1:$J$1,MATCH(TRUE,SUBTOTAL(9,OFFSET(INDEX(Sheet2!$B$2:$J$4,MATCH(A2,Sheet2!$A$2:$A$4,0),0),,,,COLUMN(Sheet2!$B$1:$J$1)-COLUMN(Sheet2!$B$1)+1))>=B2,0))

Excel counting certain cell range in row if other cell matches column

So I inherited an Excel file that is used to schedule and track PTO and OT time for about 100 employees. They have a column for every day of the year and have the year split over two sheets.
I am trying to create a totaling sheet that shows a grouping for each employee and counts up each of the types of time codes that are used in the tracking sheets. Each time type has a code that is used for condidtional formating NM1, NM2,...
I am trying to create a formula that will check the employee's name against the name column on the tracking sheet and then count just part of the row for cells that contain NM1, etc
Here is one of the cells as it is now:
=COUNTIF('2015MarNov'!$E$88:$AH$88,"*"&"NM1"&"*")
the employee name is in column D and this is counting NM1 for just January (columns E through AH).
Use this:
=COUNTIF(INDEX('2015MarNov'$E:$E,MATCH("NAME",'2015MarNov'$D:$D,0)):INDEX('2015MarNov'$AH:$AH,MATCH("NAME",'2015MarNov'$D:$D,0)),"*"&"NM1"&"*")
Change the "NAME" to the cell on the summary sheet the has the Employee name. You could also change the "NM1" to a cell reference.
Try this:
=COUNTIF(OFFSET($E$1:$AH$1,MATCH(<target employee cell>,$D:$D,0)-1,0),"*NM1*")
In this example I assumed that row 1 contains the header and that row 2 starts with the employees. If that is not the case try something like this:
=COUNTIF(OFFSET($E$5:$AH$5,MATCH(<target employee cell>,$D$6:$D$106,0),0),"*NM1*")
Edit, explanation:
Match(<target employee cell>,<range of employees>,0)
This function returns the relative row in which the target employee is found, i.e. if the employee is in D7 and the range is D6:D106 then the returned value is 1, since this the relative offset from the starting range (starting at 0)
OFFSET(<range>,<rows>,<columns>)
This function shifts any given range by the number of rows and columns as specified. In the previous function the range is offset by 1 row (shifted 1 row down).
COUNTIF(<range>,<criteria>)
The <range> is determined by the shifted range from the OFFSET function.

Lookup value next to the first number in column

I need a formula that can find the date in a cell next to another that has the first number in the column.
In column A I have dates and in column B onward I have stock prices. The dates goes back to 1990 daily, but not all the stock prices starts there. All of the prices end at 20-05-2015.
For all the stocks, I need to find out how many days they have been traded. I have the end date, but I need to look up the start date.
Therefore, I need a formula that says "Lookup the first cell which is numeric in column B, and take the corresponding cell in column A".
Thank you
You can use an array formula like this, assuming you have up to 1000 rows of data
=INDEX($A1:$A1000,MATCH(TRUE,ISNUMBER(B1:B1000),0))
confirm with CTRL+SHIFT+ENTER

Resources