Lookup value next to the first number in column - excel

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

Related

Find Last Entry in Row, then Return Value of Cell in Top Row of That Column

I have a spreadsheet that records how many times different people have been to an event, names vertically, dates horizontally, with a 1 in each cell to denote attendance, so that the total can be summed up.
What I want is to automate the process of working out who hasn't attended in a long time, so that it will lookup the right-most (most recent) entry in a row, and return the value of the date, which will be in row 1 of that column, so I can create a column of last attended date to sort data by.
I can't work out how to assemble the formula for this, what would be the best way to do it?
Many thanks for any ideas!
You could use an array formula:
{=MAX((B2:D2)*$B$1:$D$1)}
This formula would be the one to use for the 2nd row, assuming that the 1st row contains your dates and that dates range from column B-D.
Using the array formula carries out a vector multiplication (item by item) so in case there is a 1 (marking attendance) the date will be considered in the MAX formula an in case the cell is empty it will be effectively a zero. Therefore the MAX is only applied to dates where there is an attendance and the result will be the latest attendance date.
For an array formula to work you will need to use Ctrl+Shift+Enter after entering it into the cell. The brackets {} will then be added automatically. You do not type these yourself.

Excel, how to Sum on Column based on if the dates in another Column match the current month?

I need to find the sum of the cells in a Column if their end dates in another column occur in the current month.
I tried using the formula =sumif(L:L,MONTH(TODAY()),J:J) but it doesn't work.
Column L contains the full date (ex: 12/1/18).
Column J contains the values I want to add up.
So since it's December, I want to add all the values in J that have a date that is in December, and so on a so forth when I use the sheet in January.
Try this formula:
=SUM(IF(MONTH(L:L)=MONTH(TODAY()),J:J,0))
and enter it with Ctrl-Shift-Enter as it is an array formula.
Or use =SUMPRODUCT((J:J)*(MONTH(L:L)=MONTH(TODAY())))

Comparing Date and Time between Cells and Create a versioning column on which appeared first

screen shot of excel
Hello,
I have 3 columns in my excel sheet. Column A is item number, Column B is file Name, Column C is the date/time that file was modified(it is called matched in excel). I created a column D called versioning by comparing date and time of files with the same item number, right now I am doing this manually, Is it possible that it can be automated?
Thanks in advance!
Assuming your data has column headings in row 1, so data begins on row 2 and version begins on cell D2 and, just say your data stretches down to, say, row 100, you could use the following formula in cell D2:
D2: =COUNTIFS($A$2:$A$100,A2,$C$2:$C$100,"<="&C2)
Basically, you're saying For every file with the same Item number, how many have a date/time less than or equal to this row's?
That will, in effect, give you a version number.
As requested in the comment, to explain this formula in a bit greater depth, let's break it down:
Heading Match:
CountIfs($A$2:$A$100,A2:
This portion is saying "Only count if the value in $A$2:$A$100 = the value in A2" - Therefore, only count rows where the item number is the same as the one in the current row
Versioning:
CountIfs($C$2:$C$100,"<="&C2:
This portion is saying "Count the number of dates LESS THAN OR EQUAL TO C2" - Therefore, how many dates do we have that are less than or equal to the date in this current row.
So, if you put them both together, you get:
1) Only count a value with the item number is the same as this current row
2) And, of those, how many rows contain a date that is less than or equal to the date contained in the current row.
That, in effect, gives you a version number for every row.
Hope that does it.
Try this in your cell D2: (you may need to make the ranges bigger):=1+SUMPRODUCT(($A$2:$A$18=A2)*($C$2:$C$18>C2))

How can I select a specific cell value filtering with the nearest date (in a column) to select a specific row?

I am very new in Excel and I have to implement this pretty complex task (at least for me it is complex).
I put what I am doing here: https://drive.google.com/open?id=1sWHbyl-Y-GgSiX7JJ3bJ9_y8DUts-E0e
I will try to explain exactly what I have to do:
For each rows I have to "calculate" the value of the L column in this way.
Each cell into the L column is "calculated" using the following steps:
Considers the date into the H column of this row.
Search the nearest date in the past into the A column to select a specific row.
Take the E column value of this row and use it to populate the current L cell.
So doing a practical example, I want to populate the L3 cell, I have to do:
Considers the date into the H column of this row: so I obtain the value of the H3 row that is this date: 16/12/2017.
Then, into the whole A column I search the nearest date in the past in this column (in this case it is 15/12/2017), so I select the row number 4.
Take the value of E4 cell value (598,05 €) and write it into my L3 cell.
How can I do something like this?
Thank you
This is a simple INDEX(...,MATCH()) situation.
=INDEX(E:E,MATCH(H3,A:A,1))
This will return the value in column E such that the date in column A is the greatest date less than or equal to the value in H3.
Note: This assumes the dates in column A are sorted in ascending order.
VLOOKUP:
=VLOOKUP(H3,A:E,5,TRUE)
This requires the dates in Column A to be sorted.

How do I write an excel formula to count the number of a value in one column based off of a date in another column?

I have a worksheet and I'm trying to do a simple Count function, probably a countif but I'm unsure how to go about writing the formula.
I have two columns that I'd like to use for this formula.
Column N - I would like to filter for the Criteria of "C" or anytime a cell has a value of C
Column 0 - This column has dates filled in (short date format).
I would like to get a count of every C for each month, as simple as that.
In this example I filtered the date for May of 2017 and filtered for C under the Check column. We can see that there are 12 instances of C showing in the month of May 2017.
Does anyone know how to structure a formula that I would be able to Count the Number of C's for every month into the foreseeable future?
I figured out how to count the total present in a date range but unsure of how to add the date range plus Column N (Check) every time "C" is present in the cell.
=SUMPRODUCT((O:O>=DATEVALUE("5/1/2017"))*(O:O<=DATEVALUE("5/31/2017")))
Try this
=COUNTIFS(O1:O100,">="&A1,O1:O100,"<"&B1,N1:N100,"C")
Where A1 has the start date and B1 has the end date for that month. You can use DATEVALUE() instead of A1 and B1. Change as applicable
Screenshot
If you want to use SUMPRODUCT then see this
=SUMPRODUCT((O:O>=DATEVALUE("1/5/2017"))*(O:O<=DATEVALUE("30/5/2017"))*(N:N="C"))
In another column (lets say 'P' for example) I would insert a formula to give you the month number =Month(P7) - this will return 5 for May.
I would then use COUNTIFS (Like COUNTIF but it uses multiple criteria) to count where column N contains 'C' and column 'P' contains '5'.
=COUNTIFS(N:N,"C",P:P,5)
Try this....you need to select the entire Column B and named the column as 'Date'.enter image description here

Resources