sum of array results for 1st, 2nd, 3rd - excel

Trying to figure out how to use an array formula to index a transaction list and sum the found numbers within a set date range.
I.e. meal card was used 15 times this month. Need those amounts summed.
I was thinking of an existing formula that searches for the first amount given a certain text match, if only the dates are within A1 and B1 (i.e. 7/1/18, 7/31/18). Next cell searches for the 2nd occurrence, etc.
=IFERROR(INDEX([Transactions.xlsx]Transactions!$D$2:$D$9000,SMALL(IF(([Transactions.xlsx]Transactions!$B$2:$B$9000="GREAT LAKES STUDENT LN ***********0000")+([Transactions.xlsx]Transactions!$A$2:$A$9000>=$A$1)+([Transactions.xlsx]Transactions!$A$2:$A$9000<=$A$2)=3,ROW([Transactions.xlsx]Transactions!$B$2:$B$9000)-ROW(INDEX([Transactions.xlsx]Transactions!$B$2:$B$9000,1,1))+1),1)),"None")
Wasn't sure if this formula could be used for a sum function or if it's a whole different setup.
Just as the formula references, transaction file dates are in column A, description in B, and amount in D
Thank you

Related

AVERAGEIF with multiple criteria

I've seen a lot of similar questions on here, but nothing that answers what I'm specifically after.
I have a bunch of columns of contact information. Column A has the date of contact (i.e 01/11/2019). Column B has the call start time (ie. 13:42). Column D has the call end time (i.e 13:58).
I want to work out the average minutes of a call for a specific date. So to get average time spent on a call on 01/11/2019, I need a formula that searches for all instances of 01/11/2019 in column A, then for each instance get the time in column D minus the time in column B, then give me an average for all of these.
So far I have:
=AVERAGEIFS(A:A,"01/11/2019",(=D:D-B:B),>0))
Which I assumed would give me an average if column A has 01/11/19, and the result of column D minus column B is more than 0. But it doesn't.
Please help!
You can't incorporate an array of values into AVERAGEIF, nor AVERAGEIFS as they expect Ranges. However, you could re-create AVERAGEIF quite easily:
So the formula in G2 to re-create AVERAGEIF could be:
=AVERAGE(IF(A2:A5=G1,D2:D5-B2:B5))
Note: This formula is an array formula and needs to be
confirmed through
CtrlShiftEnter.
Effectively this is an array (heavy on calculation, and if you wouldn't want to enter it as such, you could replace it with:
=SUMPRODUCT((A2:A5=G1)*(D2:D5-B2:B5))/COUNTIF(A2:A5,G1)
Note: Column C is hidden in this example.
Column A contains Date, Column B Start Time , column C End Time, COlumn D ( Start time - End time) , Use formula>> SUMIFS($D$2:$D$8,$A$2:$A$8,$H$3)/COUNTIF($A$2:$A$8,H3) where H3 is the date

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.

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))

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

Use ADDRESS function to define range in MIN

I'm a newby to this forum. I have a spreadsheet which predicts bank balance based on future events. I want to know the minimum balance in the future, to ensure I don't overspend.
I can find the minimum in the account over whole range of dates by using MIN, but this includes past dates. I want to vary the range in the MIN argument based on the TODAY function.
I can return the cell reference I need to use for today's date using =ADDRESS(MATCH(DATEVALUE(TEXT(TODAY(),"dd mmm yy")),C:C,0),COLUMN(E2),4), where Column C contains dates, and Column E the bank balance. However, I cannot then use the value of the cell in the MIN formula.
So, at present, MIN(E10-E121) works for past and future levels, but if the ADDRESS routine for todays date returns E90 in cell A1, I cannot reference A1 within the MIN function to get the range E90:E121.
I have tried INDIRECT, but this gives the value of the cell at E90.
Assuming your data is in rows 2 to 100, this will give you the smallest amount anywhere in column E where the date in column C is today or later. It's an array formula, so must be entered with Ctrl-Shift-Enter:
=MIN(IF(C2:C100>=TODAY(),E2:E100))
EDIT:
In response to your comment about how to do it using one cell in a range, this uses Match to find the last cell in column C that is less than or equal to Today() and then uses that as the Index into the first half of a range specification in column E. It requires the column be sorted, ascending, by date, and if today isn't in column C it will start with the highest row in column C with a date before today. You could fiddle with the last argument in Match - 1, 0, or -1, but if C always contains today's date this will work:
=MIN(INDEX(E2:E100,MATCH(TODAY(),C2:C100,1)):E100)
Another solution that does not involve array formulas (but with a little more involved formula):
=SUMPRODUCT(MIN((C2:C100<TODAY())*(1+MAX(E2:E100))+(E2:E100)*(C2:C100>=TODAY())))

Resources