forumla automatcally filled when another cell value is added - Excel - excel

I have: =NETWORKDAYS(N25, AJ25-1) in Column O to calculate the number of busines days since an item has gone out of the building. right now I am manually duplicating it each time a new item goes out.
But is there a way to put a formula that when Column N is filled out, it will automatically added in the formula above in Column O respective to the row?
On that note, it seems my formula is a bit wonky. It works perfectly when it gets to the day AFTER it was sent out (day 1), but if it's sent out today, it will come back with the value -1 or -2 instead of "0" indicating that today's date (AJ25) is the same as the value I entered in on Column N.
I can understand why it does that but not sure how to calculate it so it doens't count today's date but starts the day after.

It seems #Jeeped's formula met the requirement:
=if(isblank($N25), "", NETWORKDAYS(N25, MAX(N25, AJ25))-1)

Related

Excel increment cellsand skip weekends or holidays

I had a google sheet that I am trying to translate to an excel file. The original formula is this:
=Arrayformula(if(J2:J<>"", regexreplace(J2:J, "[^A-Z]",), if( (weekday(B2:B) = 1)+(weekday(B2:B) = 7), ,countifs (weekday(B2:B), ">1", weekday(B2:B), "<7", J2:J, "", row(B2:B), "<="&row(B2:B)))))
I am looking to convert this to something in excel. Basically the idea behind this formula was that it would count down a column (A) looking at the next column (B) to see what the date was. If it was a weekend, it would skip the increment. If it was a work day, it would increment. This allowed me to automatically count down 20 work days for a sprint. Then it would look at a 2nd column (J) for any Notes in that column. If anything was in the column, it would skip that increment and put a letter in that row (column A). For example, if I put "Holiday" in column J, it would be an "H" in that row in column A. That way I could still count down to plan out 20 work days easily.
It worked fine in Google Sheets, but the translation to Excel was not as easy as I would have hoped.
You can use WEEKDAY.
For example, based on your description you could try:
=IF(OR(WEEKDAY(G2)=1, WEEKDAY(G2)=7), "",
IF(ISBLANK(H2)=FALSE, H2,
MAX(F$1:F1)+1))
EDIT as suggested by #Marti:
A much cleaner way is to use a second argument in the WEEKDAY function, and then cut down on the number of characters in the second IF.
=IF(WEEKDAY(G2, 3)>=5, "",
IF(ISBLANK(H2), MAX(F$1:F1)+1, H2))

Finding the last occupied cell using a formulae

This formulae "works", but it seems a bit long winded. Can anyone suggest an "easier" formulae. It returns the value in the 5th Column to a date in the 1st column which is called from a separate (and discrete) worksheet. If there is no data in the 5th column (because we haven't reached or passed that date), then the latest available data is called ($A$20, is the "calling date, on a current worksheet):-
IF(VLOOKUP($A$20,'[FTSE100.xlsx]Meteor Step Down
Plans'!$A$18:$E$2828,5)="",VLOOKUP(HLOOKUP(A20,'[FTSE100.xlsx]Meteor Step
Down Plans'!$A$18:$A$2628,MATCH(TRUE,INDEX(ISBLANK('[FTSE100.xlsx]Meteor
Step Down Plans'!$E$18:$E$2828),0,0),0)-1),'[FTSE100.xlsx]Meteor Step Down
Plans'!$A$18:$E$2828,5),VLOOKUP($A$20,'[FTSE100.xlsx]Meteor Step Down
Plans'!$A$18:$E$2828,5))
The formula is in a different workbook to the data. The formula is used to determine the last value in an array, the first column of which is a date range (01/01/2000 to 31/12/2027....say) The required data is in column 5. Entries may be up to date (i.e. the last entry was made today, therefore it will pickup todays value. The last entry may have been several days (weeks) ago, therefore it will pick up the last value in the designated column (column 5). I don't see why it can't go into a named range, as the array size is fixed. Does that help?
Thanks Ron, nearly there. That works beautifully for "missing" dates in the array. i.e. when Saturday and Sunday dates are missing, it finds the value (in column 5) of the previous Friday. However (and there is usually a "however"), if $A$20 is a date in advance of the date of the last data in the array i.e. column 5 is blank at that date, your formulae returns 0 (zero), instead of the data as at the last date that data has been entered. i.e. enter 02/04/2018 and your formulae returns 0, not the data at the last date available 28/02/2018. Is that a little more clear?? (Thank you anyway, for spending the time - I'm still trying to work out how your formulae works as it does. Is the "/" significant (other than being a "divide by" symbol, if so it's something I've never come across before? Regards...........Mike. P.S. The dates in the array (Column 1) are all in from 2016 to 2027 (excluding weekend and bank holidays), and are arranged in ascending order i.e. from 01/01/2016 to 31/12/2027
Ron - Sorry mate, buy I can't see a "second" formulae???
If I understand what you want to do correctly, (and that is hard to do since you give NO examples of your data, actual output or desired output), try:
=LOOKUP(2,1/((myDate>=A:A)*(LEN(A:A)>0)),E:E)
If it is the case that you have dates in column A and no entries in Column E, then you might have to do something like:
=LOOKUP(2,1/((myDate>=A:A)*(LEN(A:A)>0)*(LEN(E:E)>0)),E:E)
Of course, you will have to modify the cell references and named range to refer to the proper workbooks and cell.
Possibly something like:
=LOOKUP(2,1/(($A$20>='[FTSE100.xlsx]Meteor Step Down Plans'!$A$18:$E$2828)*(LEN('[FTSE100.xlsx]Meteor Step Down Plans'!$A$18:$E$2828)>0)),'[FTSE100.xlsx]Meteor Step Down Plans'!$E$18:$E$2828)
This should return the item from Column E that is either at or above the same row as myDate in Column A. If myDate does not exist in column A, it will match the nearest earlier date in Column A and return from that row in Column E.
In the second version of the formula, it also checks that there is an entry in Column E matching the column A date, and, if not, it will look above.

excel formula, if, and, or?

I am making an Excel form to use in housing. I want to be able to enter a date in one cell (tenancy end date) and calculate the number of days empty in the next cell (void days). I then have another column with date re-let.
I have managed to get it so that the void days column will stop calculating when a date is entered in the re-let column. Every week, I have to report on the number of void days for all the properties - this will be easy if I have a tenancy end date on each line, however, I don't. This means that when I copy the formula =IF(ISBLANK(J6),TODAY()-H6) onto the next line, excel inputs 42995 - not good when I want to add up that column.
I found a formula =IF(OR(ISBLANK(J11),ISBLANK(H11)),0,TODAY()-H11) to put a zero in the void days column, HOWEVER, I need it to calculate the number of void days still if there is a date in the tenancy ended column BUT, to stop calculating the number of void days when a date is entered in re-let date. I use excel by googling a lot, so, I am not an expert, just a good googler!
Assuming your data is layed out as above, place the following formula in B2 and copy down.
=IF(A2="","",IF(C2="",TODAY()-A2,IF(C2>=A2,C2-A2,"Re-Let While occupied")))
It will calculate compared to the current date when the the cell in C
is empty
It will calculate compared to the rel-let date when there is
a value in C
It will leave a blank when the cell in column A is empty
It will toss and error message to you when the end date is larger
then the relet date.
E2 was simply:
=SUM(B:B)
Assuming the only cases are:
A2=empty & C2=empty
A2=date & C2=empty
A2=date & C2=date & C2 >= A2 (so no negative void-days can occur)
=IF(A2,IF(C2,C2,TODAY())-A2,"")
Having the same as before but C2 can be smaller than A2 and you want to count as 0 days:
=IF(A2,MAX(IF(C2,C2,TODAY())-A2,0),"")

Google Spreadsheet, SUM or MINUS of above cell in the column using ARRAYFORMULA in the first row

I'm learning to use array formulas and have been successful doing simple things like adding 2 columns together in a third column. For example, I can put =arrayformula(B:B+C:C) in D1 and it adds B and C for each row.
But now I have a situation where I want to subtract two numbers in the same column. I want to take the value of that column in the current row and subtract the previous row's value from it. Without array formulas this is simple: in O7 I put =N7-N6 and cop that down so O8 gets =N8-N7, etc. But that requires copying down every time - can I do the same thing with an array formula?
Basically, can I do something like =arrayformula(B:B+(B-1):(B-1)) ?
Context: column N is a monthly account balance. I would like to calculate how much that balanced changed each month. So for row 7, =N7-N6 gives me that difference. But I'm changing the entire spreadsheet to array formulas so I can stop pasting all of the formulas and I'm stuck on this one since it's comparing the same column.
I'm trying to get everything into Row 1 so my values and calculations can start in Row 2. For example, here's one of my formulas in Row 1:
arrayformula(if(row(A:A)=1,"Total gross income",if(LEN(B:B),B:B+C:C,"")))
Unfortunately, in Column O (the one I asked about originally) if I do this:
=arrayformula(if(row(A:A)=1,"Amount saved this month",if(row(A:A)>1,if(LEN(N:N),N2:N-N:N,""))))
Or this:
=arrayformula(if(row(A:A)=1,"Amount saved this month",if(row(A:A)>1,if(LEN(N:N),offset(N:N,1,0)-N:N,""))))
Every row is off by 1 - the result that should go in Row 3 goes in Row 2, etc. And if I do this:
=arrayformula(if(row(A:A)=1,"Amount saved this month",if(row(A:A)>1,if(LEN(N:N),N:N-offset(N:N,-1,0),""))))
Then it gives me an error because the offset function is trying to evaluate something out of range (possibly it starts with N1 and tries to grab a value 1 row above N1?)
Any advice on how to handle that out-of-range error?
I think the error is because of offset range N:N which starts from N1 and you are trying to shift it -1 or one cell up, which brings the formula out of sheet.
Try this formula instead:
=arrayformula(
{"Amount saved this month";
if(LEN(N2:N),N2:N-offset(N2:N,-1,0),"")})
It uses {} to make an array. See more info:
https://support.google.com/docs/answer/6208276?hl=en
Bonus. There is no reason to check row number now.

Search column for text value, if value exists check other column for number of days from the date today?

I have an Excel spreadsheet like so:
A B
27/03/2015 Riddor
28/03/2015 Text
09/03/2015 Bees
What I am trying to do is search my column B for the word Riddor using this function:
=IF(ISERROR(MATCH("Riddor",Statistics!B:B,0)),"No Match",TODAY()-MIN(Statistics!B:B))
Within this function if the value Riddor is not found I want to show 'no match' else if the value is found I want to identify the most recent occurrence of the value Riddor in my column where its date in column A is the most recent from today. I then want to count the number of days.
So for instance my value Riddor in column B has a date of 27/03/2015. The number of days from this date to today is 5, however if I add another Riddor with a more recent date like so:
27/03/2015
31/03/2015
then I want my day count to show 1 day instead of the previous 5 days.
Can someone please show me where I am going wrong and what to do to get this working?
You will need to use a formula as defined below
Note that the flower brackets indicate that you are using this as a range formula which means you will need to hit Shift+Control+Enter and when you click on that Cell it will create the flower brackets in the end.
The below formula will retrieve the MAX Date the next part is quite simple you need to subtract from today to arrive at the difference in days. Preferably do it in another cell. I have accounted for different sheets in a modified formula at the bottom of this post. But you can test the below on the same sheet and then copy over the cell to another sheet to have it dynamically correct to account for sheet if you like. Either ways the below is tested with all events and is working
{=IF(COUNTIF(B:B,"Riddor")=0,"No Match",IF(COUNTIF(B:B,"Riddor")=1,INDIRECT("A"&MATCH("Riddor",B:B,0)),MAX(IF(B:B="Riddor",A:A))))}
Explanation
Part I - =IF(COUNTIF(B:B,"Riddor")=0,"No Match" Counts if there are any occurance of the word Riddor in that Range
Part II - IF(COUNTIF(B:B,"Riddor")=1,INDIRECT("A"&MATCH("Riddor",B:B,0)) this part accounts if there is only once occurance of the word Riddor then it uses the Match function to retrieve the date from the A Column. It would be easier with VLOOKUP but I'm assuming you dont want to change the Column Order for A & B
Part III - MAX(IF(B:B="Riddor",A:A)))) This where the Range formula is actually required. It checks in the Range B:B and Retrieves all the Dates where the B Column Matches "Riddor" and then Finds the Max date in that subset Range which would be the date closest to today's date.
Tested and Working perfectly in sample provided by your even with Multiple instances of Riddor.
Formula Accounting for the difference in Sheets not tested yet.
{=IF(COUNTIF(Statistics!B:B,"Riddor")=0,"No Match",IF(COUNTIF(Statistics!B:B,"Riddor")=1,INDIRECT("Statistics!A"&MATCH("Riddor",Statistics!B:B,0)),MAX(IF(Statistics!B:B="Riddor",Statistics!A:A))))}

Resources