Use ADDRESS function to define range in MIN - excel

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

Related

Return value in a specific column based on array formula result

I am using an array formula to find the largest value within a given month. Photo below ('Range of values') shows the values for each month, and I am selecting September as the criteria ("K5" in the formula below). Cell K5 will change based on the specific month I am looking for:
Formula:
{=MAX(IF(E8:P8=K5,E12:P21,""))}
Result:
63,490
Requirement:
I need to have a cell with the result, and a cell next to it with the corresponding 'Location', which in this case would be 6.
What would be the best formula to use in the case where you are not confined to a single column for the value lookup?
Typical Vlookup and Index/Match as I understand are limited as they require a single column to look up a value. The array is outside of that scope, but I feel I may be overthinking it, but I don't know.
if you have Excel 365 current channel you can use this formula to return both values:
=LET(data,A1:D5,
selectMonth,B7,
dataMonth,CHOOSECOLS(data,1,MATCH(selectMonth,CHOOSEROWS(data,1),0)),
TAKE(SORT(dataMonth,2,-1),2))
The basic idea is to first reduce the data range to the first column and the month that should be evaluated.
Then sort that "range" descending by the months values (= column 2 of new range) and take the first 2 rows (including header) - as this is the max value.

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

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

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

Find and sort same months name as single in Microsoft Excel 2007

I am working with Microsoft excel 2010. I have different dates like column E1:E19 that are not in specific interval. I want help to find only starts month date and paste them into G column like shown into the figure.
First of, is to say - both K_B and Ibrahim Odeh have valid and good attemps. I just want to add another option, because those options use additional rows or manual tools.
Here is the formula I came up with to solve this as shown in your screenshot - just one column, just the rows with the starting dates:
G1=SUBTOTAL(5,E$1:E$19)
G2=SUBTOTAL(5,OFFSET(E$1:E$19,MATCH(EOMONTH(G1,0),E$1:E$19,1),0,ROWS(E$1:E$19)-MATCH(EOMONTH(G1,0),E$1:E$19,1)))
It is possible to use this for the whole column, like this:
G1=SUBTOTAL(5,E:E)
G2=SUBTOTAL(5,OFFSET(E:E,MATCH(EOMONTH(G1,0),E:E,1),0,ROWS(E:E)-MATCH(EOMONTH(G1,0),E:E,1)))
And now, some explaining:
First, you need a starting point in G1 - so we use SUBTOTAL to get the earliest date in column E, using MIN (which is 5).
Now we work from here, by offsetting the range which we use to calculate our SUBTOTAL, still using MIN (5), to get the beginning of each month.
The trick is OFFSET. The first parameter is out basic range, which we will offset, then we have to determine how many rows to offset, and to not get an error, we use ROWS(basicRange) - rowOffset to always stay in out range.
MATCH is used to determine the necessary offset, by looking for the row of the last listed date of the month from G1 using EOMONTH.
Hope this clears any question.
Edit:
Because I do have to translate this, here is the original:
=TEILERGEBNIS(5;E:E)
=TEILERGEBNIS(5;BEREICH.VERSCHIEBEN(E:E;VERGLEICH(MONATSENDE(G1;0);E:E;1);0;ZEILEN(E:E)-VERGLEICH(MONATSENDE(G1;0);E:E;1)))
as long as your dates columns is sorted as it looks in the example then do the following:
insert a row above row 1 (for use of the formula)
enter a formula in column A in all rows that your table has. The formula reads:
=If(NOT(YEAR($E2)&MONTH($E2)=YEAR($E1)&MONTH($E1), MAX($F$1:$F1)+1, "")
This will add increasing numbers from 1 to the number of months involved only next to the first date in your table for that month.
Then in your table in column G put:
=VLOOKUP(ROW(), A:E, 5)
you can drag this formula down as far as you want. The formula finds the first record in A:E that matches the row number in G (ROW() in G1 returns 1), Then VLOOKUP() will return the value in the 5th column in A:E (which is column E with the date).
The Formula in column A should be to the left of the dates for the VLOOKUP() formula to work.
Alternatively you can put it in a column to the right but then use another formula in stead of VLOOKUP() in column G:
=SUMIF(F:F,ROW(),E:E)
This sums all values in E for rows where the value in F matches the row number of the cell in G.
I think you need to use analysis-toolpak Add-on to perform this task:
check out the following URL if you need to know how to load it:
http://office.microsoft.com/en-us/excel-help/load-the-analysis-toolpak-HP001127724.aspx
Regards

Resources