Formula in Excel query - excel

I need help with stopping Excel from updating formula after a criteria is matched. I have the following:
Cell A1 is =TODAY() cell
B1 is "Date Received"
Cell C1 is number of days open (contains the formula). This value is obtained by the following formula:
=IF(B1="","-",IF(NETWORKDAYS($B1,$A$1)>0,NETWORKDAYS($C1,$A$1),"-"))
This returns the number of days a sales quote has been open.
The second part is once the invoice has been done and now I have a second date to use.
Cell D1 is Date the invoice is completed Cell E1 is number of days taken to invoice (contains the formula)
This is obtained by the following formula:
=IF(NETWORKDAYS($B1,$D1)>0, NETWORKDAYS($B1,$D1),"-")
What I need is once Cell D1 is filled out that Excel freezes Cell C1 and not continue counting days between B1 and A1 as cell A1 will update each new day? Can this be done and how if so?

Related

Putting an Excel Formula Within an IF formula

I am trying to set a cell to only display a date if there's a date in the reference cell. The date displayed needs to be exactly 1 year later so I'm using the following formula in cell C3:
=IF(B3="","","=DATE(YEAR(B3)+1,MONTH(B3),DAY(B3)")
The desired result is that if there is a date in B3, a date 1 year later will appear in C3. If there is no date in B3, C3 will remain blank.
If you're typing into a cell there are no speech marks -
=IF(B3="","",Date(year(b3)+1,month(b3),day(b3)))

Use Cell info in a formula

I was wondering if it's possible to use info from a cell in creating a formula. Here's the situation;
A1 = Date (01/01/17)
A2 = Month from that date (January)
I have different worksheets in the book for every month so for January the sheet is called January.
Is it possible to create a formula where I can reference a cell in a page that corresponds to the month in A2.
So for example in A3 the formula would be =January!A1
But instead of Jan I want it to be dynamic so it would change to any month depending on what I input in previous cells.
In A2 to get the month try
=TEXT(A1,"mmmm")
and then in A3
=INDIRECT(A2&"!A1")
or you can cut out A2 altogether and use just
=INDIRECT(TEXT(A1,"mmmm")&"!A1")

View week of the calendar in Excel

I want to create a calendar in Excel with 2 sheets:
Actual monthly calendar
Display current week of the month AND cells displaying data accordingly
Task: I want to show the people who are working this week rather than the whole month.
I got the code for current week display:
=TEXT(TODAY()-WEEKDAY(TODAY(),3),"mmmm dd, yyyy")&" - "&TEXT(TODAY()-WEEKDAY(TODAY(),3)+6,"mmmm dd, yyyy")
So, this will show the current eeek starting on Monday and ending on Sunday (as I needed to display)
Now:
On sheet 2, I want to show ONLY the dates of week on the calendar based on this above calculation.
Match the week start date to a list of Mondays in a different tab, then display the name of the person on the cells below the matching date (this is VLOOKUP, HLOOKUP)
Have this automatically updated every week with correct info
Is it possible? How?
I am not a coder at all.
In a blank sheet (Sheet2):
A2 =TODAY()
A4 delta
A5 to A19 consecutive values from -7 to 7
B4 Today+delta
C4 Weeknum
D4 Weekday
E4 Key
F4 Today+delta (again)
B5 =$A$2+A5 and then replicate this formula until B19
C5 =WEEKNUM(B5)
D5 =WEEKDAY(B5)
E5 =CONCATENATE(C5,"-",D5)
F5 =B5
Now extend those formulas (B5:F5) until row 19 (B19:F19)
In another blank sheet (Sheet1)
In the firs row put your formula
A2 to G2 consecutive values from 1 to 7
A3 =CONCATENATE(WEEKNUM(TODAY()),"-",A2)
Extend that formula in the range A3:G3
A4 to G4 Weekday names from Monday to Sunday
A5 =VLOOKUP(A$3, Sheet2!$E$5:$F$19, 2, 0)
Extend that formula in the range A5:G5
Until now, you should have Sheet1 with the requirement of the week showing every day of the current week. If you need a different week, just change the value in Sheet2!A2 adding or substracting days.

Insert rows into excel range via formulae

I have the following range in column A :
01-Mar-12
01-Apr-12
01-May-12
01-Jun-12
01-Jul-12
01-Aug-12
01-Sep-12
01-Oct-12
01-Nov-12
01-Dec-12
01-Jan-13
01-Feb-13
01-Mar-13
01-Apr-13
01-May-13
01-Jun-13
01-Jul-13
01-Aug-13
01-Sep-13
In column B, I would like the same list of dates ( i.e. March 12 -> Sep 13), but I would like every August to be duplicated:
01-Mar-12
01-Apr-12
01-May-12
01-Jun-12
01-Jul-12
01-Aug-12
01-Aug-12
01-Sep-12
01-Oct-12
01-Nov-12
01-Dec-12
01-Jan-13
01-Feb-13
01-Mar-13
01-Apr-13
01-May-13
01-Jun-13
01-Jul-13
01-Aug-13
01-Aug-13
01-Sep-13
I can add as many columns in between as I like, but it must be done with formulae.
I'm having a little trouble figuring this out - any help would be much appreciated.
A formula is not capable of inserting rows.
Copy ColumnA to ColumnB, insert a cell and shift down immediately under each Aug and in the blanks created enter:
=R[-1]C
This formula works, assuming the values in column A are unique. Paste the formula into cell B3.
=IF(AND(MONTH(B2)=8,MONTH(B1)<>8),B2,INDEX(A:A,MATCH(B2,A:A,0)+1))
The current formula assumes that B1 and B2 are part of the list in column B. You'll have to manually fill in the values for B1 and B2 unless you change the formula a little.
What the formula does:
If B2 is August and B1 is not, then B3 copies the value of B2.
Otherwise B3 is the date in Column A found under the date B2.
You can then copy the formula into the remaining cells below B3.

Excel formula for just M-F and T-S of each month

I have to build a report that has two different date columns in it; M-F of the previous month, and T-S of the previous month.
If in column A I have a list of all days from the previous month
A
1 | 8/1/2013 |
2 | 8/2/2013 |
...
31 | 8/31/2013 |
Is there a formula that could be used in columns B and C to get the necessary dates?
Well, sure, you can use this formula to avoid the blank cells in between the dates:
=IFERROR(INDEX($A$1:$A$31,SMALL(IF(MOD($A$1:$A$31,7)>1,ROW($A$1:$A$31,9^99),ROW())),"")
This formula (for Monday to Friday) needs to be called with Ctrl+Shift+Enter. After doing this for the first date, you can drag down to the bottom.
For the one with Tuesday to Saturday, it's a bit longer;
=IFERROR(INDEX($A$1:$A$31,SMALL(IF(((MOD($A$1:$A$31,7)>2)+(MOD($A$1:$A$31,7)=0))>0,ROW($A$1:$A$31),9^99),ROW())),"")
But at the same time, you have to call this function with Ctrl+Shift+Enter as otherwise, you won't be able to get the other dates (you will get #NUM! instead for the other dates).
Instead of typing the days in column A, you could do something like this:
In cell B1 is this formula (formatted as m/d/yyyy):
=TODAY()
In cell B2 is this formula (formatted as mmmm):
=DATE(YEAR(B1),MONTH(B1)-1,1)
In cell A5 is this formula (formatted as m/d/yyyy):
=IF(WEEKDAY(B2,2)<6,B2,B2+1+(WEEKDAY(B2+1,2)>5))
In cell A6 and copied down to A37 is this formula (formatted as m/d/yyyy):
=IF(NETWORKDAYS(B$2,EOMONTH(B$2,0))>COUNT(A$5:A5),A5+1+2*(WEEKDAY(A5+1,2)>5),"")
In cell B5 is this formula (formatted as m/d/yyyy):
=IF(AND(WEEKDAY(A5,2)<>{1,7}),B2,B2+1+(OR(WEEKDAY(B2+1,2)={1,7})))
Lastly, in cell B6 copied down to B37 is this formula (formatted as m/d/yyyy):
=IF(B5="","",IF(MONTH(B5+1+OR(WEEKDAY(B5+1,2)={1,7})*2)<>MONTH(B$2),"",B5+1+OR(WEEKDAY(B5+1,2)={1,7})*2))
Now the M-F and T-S dates will automatically update whenever you enter a new month. If you'd prefer to manually control it, you can just type in the date of a month in cell B1, like 8/1/2013. Then the formulas will take care of the rest and will bring in the appropriate dates from July.
You can use WORKDAY function for this:
Given that you already have 1st of the previous month in A1 put this formula in B1
=WORKDAY(A$1-1,1)
.....and this one in C1
=WORKDAY(A$1-2,1)+1
then in B2....
=IF(B1="","",IF(MONTH(WORKDAY(B1,1))=MONTH(A$1),WORKDAY(B1,1),""))
and in C2
=IF(B1="","",IF(MONTH(WORKDAY(B1-1,1)+1)=MONTH(A$1),WORKDAY(B1-1,1)+1,""))
and copy those latter two formulas down to row 23
When there are fewer than 23 MF days or TS days in the month the lowest cells will display as blanks.
If you want to exclude listed holiday dates you can also do that with WORKDAY

Resources