I'm trying to meticulously track interest growth and monthly payments on a loan in excel. Instead of manually putting in the amount for each first day of the month, is there a way to write an excel if statement so that it will be a certain value for the first day of a month and zero on all other days?
Sort of like: =IF("day is first day", $100,$0) That way I can drag the formula all the way down. Worth noting that inside the quotation marks will be a cell number that points to the column directly left of the formula with a date in it.
So like this:
| Date | Payment | Balance |
|:--------:|:-------:|:-------:|
| 01/30/16 | $0 | $1000 |
| 01/31/16 | $0 | $1000 |
| 02/01/16 | $100 | $900 |
| 02/02/16 | $0 | $900 |
Try this
=IF(A2=Date(Year(A2),Month(A2),1),100,0)
You need the DAY Function.
=IF(DAY(A2) = 1,100,0)
You can use the DAY() function to get the day number
=IF(DAY(A1)=1,100,0)
Related
I am looking for a formula that will populate a cell based on yesterday's day value for last month.
Please see my example:
Prior Month Comparison | | |
5-Jul | 5-Aug |4-Aug | 5-Jul
Total Number of Records: 10 | 25 | 7 | 10
Total Records Sold: 5 | 3 | 0 |... 5
I have all of July records to the right of my August records. I might have to use arrays so I'm not sure what would be the best approach.
I have looked into index/match but I'm not sure how to best apply this formula. I am available to any formula that will help me fill out my Prior Month Comparison column.
Thanks!!
Use HLOOKUP:
=HLOOKUP($B$1,C:E,ROW(),FALSE)
To make it easy
+---+----+-------------+
| | A | B |
+---+----+-------------+
| 1 | xx | 12-05-2015 |
| 2 | xx | 15-05-2015 |
| 3 | yy | 13-05-2015 |
| 4 | yy | 16-05-2015 |
+---+----+-------------+
(today is 14-05-2015)
I need to get the MAX date value for each "A" value only if it is before today.
In case it's not, move to the 2nd biggest value. Case it does not find, empty cell.
What I've done so far:
=MAX($A$1:$A$4='xx';$B$1:$B$4<TODAY();$B$1:$B$4)
and confirm with SHIFT+CTRL+ENTER
The error I get is that it yields 13-05-2015 as max value for xx, which is obviously wrong (as if it does not take into account the $A$1:$A$4='xx'
You need to use nested if-functions. I.e. change your formula into:
{=MAX(IF($A$1:$A$4="xx", IF($B$1:$B$4<TODAY(), $B$1:$B$4)))}
And end it with Ctrl+Shift+Enter
A standard (non-array) formula alternative.
=MAX(INDEX((B:B)*(A:A="xx")*(B:B<TODAY()), , ))
This formula would benefits from having its cell ranges cut down from full columns to something closer to the usable data range.
If your dates are sorted ascending as shown in the example then you can use LOOKUP like this:
=LOOKUP(2,1/(A$1:A$100="xx")/(B$1:B$100<TODAY()),B$1:B$100)
Doesn't require "array entry"
I need to do a total sum based on a look up, however the look up is dynamic. To be more specific I have a totals table like so:
Type | Total
Charges | 633.86
Costs |
Misc |
This needs to sum up figures based on certain code in a look up table:
Type | Code
Charges | N77RE
Charges | N5762
Charges | M7YRE
Costs | M888
Costs | O999
MISC | ABCS12
MISC | ABCs13
MISC | ABCS14
The financial data is presented like so:
Transaction | Code | Costs
123456 | N77RE | 19.99
123454 | O999 | 24.99
123452 | N5762 | 458.99
123450 | O999 | 487.55
123448 | N5762 | 45.55
So to sum it up I need to do a look up function to check to see what code has what value and then sum it up?
This image is based on the answer, it only seems to sum up the first Code?
Assuming your second table (Types and Codes) is in D1:E9 and the third table (Transactions, Codes and Costs) is in G1:I6 then with "Charges" in A2 use this "array formula" in B2
=SUM(SUMIF(H$2:H$6,IF(D$2:D$9=A2,E$2:E$9),I$2:I$6))
confirm with CTRL+SHIFT+ENTER
and copy down as required
The IF function provides a list of the valid codes for the type in A2 then SUMIF sums the costs for each code. This gives you an array of totals which SUM then sums to give your final answer.
For the example shown I'd expect to get 524.53 as the total for Charges
I searched through internet and came up with nothing. I have two tables. one includes work dates and the other has vacation dates. I have to find the intersected dates.
Let me give an example;
Work Table
1| A | B | C | D
2|Person | Work Start Date | work finish Date |Intersected Vacations
3|Mike | 01.08.2013 | 10.08.2013 |1 (Needed to find)
4|John | 16.08.2013 | 25.10.2013 |3 (Needed to find)
Vacations Table
1|A |B |C
2|Person |Vacation Start Date |Vacation End Date
3|Mike | 05.08.2013 | 05.08.2013
4|John | 20.09.2013 | 21.09.2013
5|John | 01.10.2013 | 01.10.2013
So, I need an excel formula to calculate the vacations between the work days.
Assuming you are counting all days within the periods, including Saturdays and Sundays you can use this "array formula" as per my screenshot below:
Formula is as follows in D3:
=SUM(IF(A$8:A$10=A3,IF(C$8:C$10>=B3,IF(B$8:B$10<=C3,IF(C$8:C$10>C3,C3,C$8:C$10)-IF(B$8:B$10<B3,B3,B$8:B$10)+1))))
confirmed with CTRL+SHIFT+ENTER and copied down to D4
This may look like overkill for your small example but I'm assuming your real data is larger - this solution can be extended as required, even for multiple unsorted vacation periods
Say I have a spreadsheet with the following, and for convenience say all of this starts from cell A1.
---------------------------------------
| Date | Item | Account |
---------------------------------------
| 01/09/2011 | Testing 1 | USD |
| 03/09/2011 | Testing 2 | USD |
| 11/09/2011 | Testing 3 | USD |
| 20/10/2011 | Testing 4 | JD |
| 22/10/2011 | Testing 5 | JD |
| 25/10/2011 | Testing 6 | USD |
| 03/11/2011 | Testing 7 | USD |
| 05/11/2011 | Testing 8 | JD |
---------------------------------------
Now, I want to run a report for a month, starting on 1/10/2011 and ending on 31/10/2011. I need to find the first row on or after the starting date, and then get every subsequent row until the end date. If I can figure out how to get the row reference for the first and end dates, then I can figure out the rows in between (obviously!).
I have only been able do these sorts of matches on exact matches ie. no idea how to do 'greater/less than' matches.
How would I go about matching on both the date and the account columns?
Needless to say, this needs to be in a formula.
=match(date(2011,10,1),a2:a9,1)+1
=match(date(2011,10,31),a2:a9,1)
First formula shows row for the first record for October, second formula for the last day. Data must be sorted in ascending order.
Use the following Array Formula for finding the Row containing the earliest date, which is equal to or greater than the date mentioned in cell C1 (in your case this is 1 October).
=MATCH(MIN(IF($A$1:$A$30>=C1,1,9999)*$A$1:$A$30),$A$1:$A$30,0)
Date list is in cells A1 to A30. Change the references as required.
Data need not be sorted in ascending or descending order.
Use the following Array Formula for finding the Row containing the latest date which is equal to or less than the date mentioned in cell D1 (in your case this is 31 October). Data need not be sorted in ascending or descending order.
=MATCH(MAX(IF($A$1:$A$30<=D1,1,0)*$A$1:$A$30),$A$1:$A$30,0)
If you want the earliest and latest dates, use the following Array Formulas.
=MIN(IF($A$1:$A$30>=C1,1,9999)*$A$1:$A$30)
=MAX(IF($A$1:$A$30<=D1,1,0)*$A$1:$A$30)
All the formulas used above are Array Formulas. To enter an array formula, use Control+Shift+Enter instead of Enter.
Vijaykumar Shetye, Goa, India
I would recommend using a pivot table for this. Look at the second link on in the "Excel Templates - Pivot Table" section on this page on the Contextures site.