Count values based on dates in another column in excel - excel

I have a list of values in a column and list of dates in another
I am trying to get the counts of values for different period of dates
What would be the ideal way to approach this

Your example seems incorrect -> the count "Moved between April and May" should be 0.
You need a COUNTIFS() function.
In your example use in cell B18:
=COUNTIFS(A2:A10;">="&DATE(2022;4;1);A2:A10;"<"&DATE(2022;5;1);B2:B10;"Moved")
In cell B20:
=COUNTIFS(A2:A10;">="&DATE(2022;2;1);A2:A10;"<"&DATE(2022;3;1);B2:B10;"Deleted")
I would put the criteria for the Countifs in separate cells so you can reference them. That is more flexible.

Related

Sum values based on first occurrence of other column using excel formula with Subtotal function

I already viewed the posting about summing values based on first occurrence in another cell but I would like to add a complication and nestle in a subtotal function. Basically I would like to sum values in the Score column based upon the first and only instance of a value in Color with subtotal filtering via one formula.
There are two formulas that somewhat give me the two components required but I'm limited in my formulaic abilities to combine these:
Sum values based on first occurrence in another column:
=SUMPRODUCT(B2:B8/COUNTIF(A2:A8,A2:A8))
Subtotal with sumproduct:
=SUMPRODUCT(B2:B8,SUBTOTAL(9,OFFSET(C2:C8,ROW(C2:C8)-MIN(ROW(C2:C8)),0,1)))
Unfiltered Table
Filtered Table
Any ideas?
Many thanks in advance
You can combine both formulas as below:
=SUMPRODUCT(B2:B8/COUNTIF(A2:A8,A2:A8),SUBTOTAL(3,OFFSET(A2:A8,ROW(A2:A8)-MIN(ROW(A2:A8)),0,1)))
The first part of the above formula is from your SUMPRODUCT formula so it is easy to understand, the second part of the formula should be using 3 - COUNT for the SUBTOTAL formula so it will return 1 for values showing in the filtered range and 0 for values that are not.
Let me know if you have any questions. Cheers :)

Formula to match two values between two worksheets

I have two spreadsheets...Days and Visits. The first spreadsheet (Days) contains Name/Date. The second spreadsheet (Visits) also contains Name/Date. I am trying to get a formula that if the name and date appear on both spreadsheets that a value of "Yes" is returned on the Visits spreadsheet.
This is the formula I'm using but the Yes/No column an say "No" but I can clearly see some names should say Yes.
{=IFERROR(INDEX('Physician Visits'!$A$2:$F$800,MATCH(1,IF('Physician Visits'!$A$2:$F$800=A2,IF('Physician Visits'!$A$2:$F$800=C2,1)),0)),"No")}
Any help would be most appreciated!
Because of the way you have written your formula you are trying to find to different values in the same cell. The two IF's iterate together and since the ranges in the criteria are the same the cell in which you are looking are the same. And one cell cannot equal two different values at the same time.
There is a better way, use COUNTIFS()
=IF(COUNTIFS('Physician Visits'!$A:$A,A2,'Physician Visits'!$F:$F,C2),"YES","NO")
This assumes your comparing column A to Column A and Column C to Column F. If different ensure your are comparing the correct columns to one another.

Excel get value of cell in a column based on values of other cells in it's row

What is the simplest way to get the value of a cell in a column if the other cells in it's row contains specific values?
I mean without using array formula or adding additional columns to create combined values. Array formula may confuse my students at the moment. I could be wrong but I feel there must be a formula for this. Something like =GetValue(FromColumn,Condition1Range,Condition1,Condition2Range,Condition2)
Much like Countifs() but instead of counting, I want to get that value instead.
Example,
I want to get the date of a row who's year is 2015, week is 1, and day is 5.

Excel: Count every date in a column and give back the sum of dates (preferably in *one* formula)

As you will see in my picture, I do have the following problem: I want to find out whether a value in a cell of column A contains a date or not. In order to do so, I have used the following formula in cells B1:B8:
German Excel formula: =WENN(ISTZAHL(TAG(A1));1;0)
English Excel formula: =IF(ISNUMBER(DAY(A1)),1,0)
As you will quickly notice, it works for B1:B6 but is faulty when it comes to B6:B7, etc.
So: What is wrong with that formula? Column A is formated as TT.MM.JJJJ (or DD.MM.YYYY) as a whole.
If that formula were to work properly, I could easily count the number of dates in column A using column B. But: Is there a way to do this without having to use column B, that is, checking whether a cell in A contains a date and adding it up in one cell with a respective formula?
You need to check if the cell is empty before checking if it's a date:
=IF(A1!='', IF(ISNUMBER(DAY(A1)),1,0), '')
If you want the sum, you can use
=COUNTIF(B16:B23,">32874")
32874 is the decimal representation of 1/1/1900, if you need to parse earlier dates, you can just use 1 too.

How can I copy row values based on the value of one of the cells in that row?

Column A consists of a series of dates extending from today into the future.
Columns B-E are other values corresponding to those dates.
Initially the first three rows were blank. Then I used the function TODAY() to obtain today's date and put that in cell A1. Today's date matches a value in cell A91. I now want the values in B1-E1 to match the values in B91-E91.
How can I go about doing that? It needs to be done with reference to cell A1 because I want it to update whenever the spreadsheet is opened. Thus I can't just type =B91 in B1.
Here's what it looks like
I am working in Google Spreadsheets but I suspect an answer related to Microsoft Excel would probably work here too.
The VLOOKUP function works, for example
=VLOOKUP(A1,$A$3:$E$1000,2,FALSE)

Resources