RE: Excel formula for staff training - excel

=IF(OR(AND(E4="Active",G4<TODAY()),ISBLANK(G4)), "Overdue", "OK")
That is my current formula. G4 = date they last completed training, E4 = column stating whether they are active or not - if not then I don't want it to display Overdue. If G column is blank & E column is active I want it to display Overdue.
The problem:
I have got a database of staff names, and then whether they are active, and then if they are due training. I need a formula that takes into account if they are active or not, then if the date their training is Overdue (if the date is 1 year + past the completion date of their last training) and to display this in a new column as Overdue or OK. Ok being they don't need to book training. Additionally if the G column is blank it should treat that as over a year since the last training.
So only if the staff are "active" should it display Overdue in the final column. (as well as the date of G column being over a year before the current days date).
Im struggling to get my above formula to work :/ any assistance would be much appreciated

Ignoring leap years (for simplicity), maybe:
=IF(AND(E4="Active",G4<TODAY()-365), "Overdue", "OK")

Related

In Excel how to count between date1 and date2 that have cells in row that contain text?

I need to choose cells in one column that are between two dates, and then based on the rows that contain those dates, choose cells in another row that also contains content.
I didn't use ISBLANK because it counts a formula yet an empty cell as a not-blank. Instead check if there is content by "*".
Here is what I came up with, but instead of returning the number of cells, instead this returns TRUE (which obviously isn't what I want).
In the formula below I am assuming:
C:C is the whole column containing DATES.
E:E is the whole column containing CONTENT.
The date range in this case is January 1, 2018 to January 31, 2018.
"*" means is there is content in the cell
=IF(AND(COUNTIFS(C:C,">="&"2018-1-1",C:C,"<="&"2018-1-31"),COUNTIF(E:E,"*"))=0,"",AND(COUNTIFS(C:C,">="&"2018-1-1",C:C,"<="&"2018-1-31"),COUNTIF(E:E,"*")))
My goal is to:
count the numbers of the cells in column E that are between the dates in column C
if the whole formula is 0, then return a blank.
See this picture of a sample excel sheet to make my intent clear:
How can I get my formula working so it does as needed?
SOLUTION
Hi all, so thanks to #girlvsdata, we have a working solution. I had to do a couple edits to her code to work for my uses, but her formula overall works perfect. Here is the solution:
To choose all cells in column E that are not blank, in between the date range of all of January (unknown end date) based on the adjacent C column if that is your date column, then the solution is:
=IF(COUNTIFS(C:C,">="&"2018-1-1",C:C,"<="&EOMONTH("2018-1-1",0),E:E,"*")=0,"",COUNTIFS(C:C,">="&"2018-1-1",C:C,"<="&EOMONTH("2018-1-1",0),E:E,"*"))
Note that "2018-1-1" is January 1 2018, and EOMONTH("2018-1-1",0) is the last valid day of January in the year 2018 (in this case, 31, but if it is different another year (e.g. for February this works for leap years too) then it will be that last day). Also it eliminates the need to calculate which is the last day or every month, as well as months that have changing end dates dependent on the year (e.g. Feb). This is important to eliminate a margin of error.
The only thing you have to do to change the month is only change e.g. -1- (Jan) to -2- for Feb, or change the year for other years. With this formula you can ignore the day part.
If the answer is 0 (no cells have any content in between the range), then the cell is blank instead of 0. (GOod for when you want to create a sheet checking future dates for future reference when more rows are added to the sheet.
It also works across different sheets, just use, say your other sheet is called "Tracker" then use Tracker!C:C and Tracker!E:E. Hope it helps!
Thank you all! :D
(Please note: My local date format is day, then month)
With the data laid out as in your example above:
A B
1 Dates |Content
------------+-------
2 1/01/2018 |
3 2/01/2018 |123456
4 3/01/2018 |
5 4/01/2018 |12398
6 5/01/2018 |484
7 6/01/2018 |1538
8 7/01/2018 |
9 8/01/2018 |
10 9/01/2018 |
11 10/01/2018 |14648
12 11/01/2018 |
13 12/01/2018 |145615
14 13/01/2018 |
And with the date range in cells D2 and E2:
Date Start Date End
2/01/2018 7/01/2018
This formula returns the count:
=COUNTIFS(A:A,">="&D2,A:A,"<="&E2,B:B,">0")
This will depend on whether your numbers in Column B are formatted as text or number. If they are formatted as numbers, the above formula will work. If they are formatted as text, replace the last section ">0" with "*".
This formula adds the conditional part of your question:
=IF(COUNTIFS(A:A,">="&D2,A:A,"<="&E2,B:B,">0")=0,"",COUNTIFS(A:A,">="&D2,A:A,"<="&E2,B:B,">0"))
(If the formula returns 0, show blank)

EXCEL - How to spread X amount over N number of months

I am creating a revenue recognition model that tells the user the specific months X amount of revenue falls into based on specific start date. For example, I have an invoice dated 1/1/17 for $1200 total in monthly services that will be incurred over the next 3 months ($400 per month)
I want to create the model so the user enters the invoice date "1/1/17", the invoice amount "1200", and the number of months the invoice amount is spread over. In this case "3".
The model is setup with 24 columns which have the MM/YYYY header in each column. "Jan 2017, Feb 2017..Dec 2018". As the user enters the date, amount and # months, the values per month "400" will populate in Jan, Feb, and March 2017. The remaining months will have zero or be blank because no revenue will be allocated in those months.
I don't want anyone to give me the answer here, but I don't even know if this is possible in excel without using VBA. Some insight in how to get started would be helpful. Thanks!
This could be a start:
B1, B2 and B3 are the input cells. B1 must be a date not a string.
D1 to O1 are the months. The values must be dates, not strings, but could then be formatted to show only month and year. Format MMM YYYY for example.
You need only inputting D1 and E1 as dates 2017-01-01 and 2017-02-01, then select D1:E1 and fill to right. Then a series will be created having from step to step the difference of E1 - D1, which is 1 month in this example.
Formula in D2 is
=IF(AND(D$1>=DATE(YEAR($B$1),MONTH($B$1),1),D$1<=DATE(YEAR($B$1),MONTH($B$1)+$B$3-1,1)),$B$2/$B$3,"XX")
and can be filled to right as needed. In the example up to O2.
Now if you are changing any of the input cells, the values in D2 to O2 will also changing due to the formula.

excel vba shifting formulas based on sales lead time

I trying to find the correct code to move my formulas over x number of cells. The x would represent sales lead time. Lets say I make a January sale, but that revenue wont actually be received until 7 months later. So for Jan I wont receive until July, for Feb I wont receive until August, for March I wont receive until September and so on.
I'm looking for something to automate or shift my formulas that total my sales over based on a lead time cell. So lets say I change my lead time to 5 months everything shifts over to reflect 5 months instead of 7.
Any help would be greatly appreciated.
Hope thats not too confusing.
Thanks for any help!
You seem to be looking at the problem from the wrong end: Instead of asking when your January sales proceeds will be received, try asking which proceeds you will receive in July. Then you arrive at a structure like this:-
Column A = Date of sale
Column B = Description
Column C = Sales amount
Column D = Expected delay in months
Column E and up = Jan, Feb, etc. one column for each month
Write the starting date in cell E1, say 1/1/2017.
In F1 paste this formula: =DATE(YEAR(E1),MONTH(E1)+1,1)
Format the range E1:F1 as 'Custom' using the string MMM yy
Copy F1 to the right as far into the future as you require
Now you have a column for each month. If you change the value in E1 all captions will change accordingly. That's good when you need a new sheet for next year.
Write this formula in E2: =IF(MONTH($A2) + $D2 = MONTH(E$1), $C2,0)
Copy right and down as far as you require
Now, make an entry. Say on Jan 17 you had a sale of $1200 and you expect to receive the money 6 months later.
Enter the date in column A = 17/1/2017
Enter the amount in column C = 1200
Enter the expected delay in column D = 6
The amount appears in the July column. Change the value in column D to 3 and the amount moves to April.
All the other columns show a zero. If you don't like that, go to File ->Options -> Advanced >>Display options for this worksheet = uncheck the checkbox for "Show a zero in cells that have zero value".

VBA, change part of date in cell

I have a large sheet of data where i need to change the date (day) in 4 or 5 columns to match the date (day) in another column. For example in 'H' i have 16/05/15 etc. and in the other columns all the days are the 1st of the same month. I would like to change the day '1' to the same day '16' as in column 'H' it will take me hours to do, can anyone help me out with some code that would do it for me?
Thanks.
If this is a one-off, you could just write a formula in a temporary column that calculates DATE using the YEAR and MONTH of the original cell and the DAY of column H (watching out for 29th of Feb in non-leap years, if the year in H is different to the year in the other cell), and then "paste values" that result back over your original cells.
For example, assuming data you want to change is currently in K2, then place the following formula in X2 (or wherever else you like):
=IF(MONTH(DATE(YEAR(K2),MONTH(K2),DAY(H2)))<>MONTH(K2),
DATE(YEAR(K2),MONTH(K2)+1,0),
DATE(YEAR(K2),MONTH(K2),DAY(H2)))

Excel - How to copy rows and discard others based on today's date?

I have a worksheet, and in one sheet called Payments, every row, on column A has a date in ascending order, on column C there's a client name, on column E there's a monetary value and on column G there's a Yes/No Checkbox.
The Dates sometimes repeat themselves, but the other values, do not (the Y/N/ Checkbox also repeat themselves). So, sometimes i have:
m / d / y
02/02/2014 - Client X - 100,00 - y;
02/02/2014 - Client Z - 120,00 - n;
02/03/2014 - Client W - 110,00 - n;
etc.
What I need is this: on another sheet called Today's Dues, in the same worksheet, when colum A from Payments sheet (the date column) is today's date, the entire row from that column from A to G) is copied to Todays Due sheet. And the same would apply to all the other rows where the A column had todays date. But, tomorrow, that sheet would need to update itself, so the information from yesterday would not be there anymore, just the new rows with the new day's date.
Since there is no more than 10 payments a day, the space available on Todays Due would not need to be bigger than 10 rows, but would have to get information from the entire A column of Payments sheet.
What is was thinking was to create a Macro that would duplicate ALL data from Payments sheet, then automatically apply a filter with todays date. This Macro would be the first thing happening on opening. But this has been proving to be very frustrating. I cant seem to make Excel recognize my dates as dates, only as text, i tried everything.
Any help, or a more elegant solution, please ?
thanks
Assuming multiple rows of same date are in order, these should work.
Date:
=IF(INDEX(Payments!A:A,MATCH(TODAY(),Payments!A:A,0)+ROW()-2)=0,"",INDEX(Payments!A:A,MATCH(TODAY(),Payments!A:A,0)+ROW()-2))
Client Name:
=IFERROR(INDEX(Payments!$C:$C,MATCH($A2,Payments!$A:$A,0)+ROW()-2),"")
Value:
=IFERROR(INDEX(Payments!$E:$E,MATCH($A2,Payments!$A:$A,0)+ROW()-2),"")
Yes/No:
=IFERROR(INDEX(Payments!$G:$G,MATCH($A2,Payments!$A:$A,0)+ROW()-2),"")
Put each formula in consecutive columns to get your 4 unique values. Drag these down for 10 rows to collect all possible values.
**Note: The 2 in "ROW()-2" will be whatever row number you start this on. I used 2 since I put headers in the first row.

Resources