Use Cell info in a formula - excel

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

Related

Formula in Excel query

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?

Excel formula AVERAGEIFS i think

I'm trying to use AVERAGEIFS not sure if that's the best but here is the issue. Reporting in the new year is a PITA, the spreadsheet has dates in column A with the corresponding value in column B in 7 day increments for example Cell A1 1/7/18 Cell B1 95%, Cell A2 1/14/18 Cell B2 100%, Cell A3 1/21/18 Cell B3 62%, this goes on for the entire year. In a different cell, say C1 id like to see the average for January, in cell C2 Feb and so on.
Simplest to add another column with month or month and year (if you have multiple years worth of data), e.g. in C1 copied down
=MONTH(A1)
....and then average for January is simply
=AVERAGEIF(C:C,1,B:B)
Repeat for other months
Assuming that you are not trying to proportion the percentage in a week that straddles January to February then this for January,
=AVERAGEIFS(B:B, A:A, ">="&DATE(2018, ROW(1:1), 1), A:A, "<"&DATE(2018, ROW(1:1)+1, 1))
Fill down for subsequent months.

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.

How can I extract month name and quarter from a date in Excel?

I would like to take date information from cell A1 (e.g. 10/10/2013 09:00) and transfer the month into cell B1 (October) and then based on the month fill in cell C1 the proper quarter (Q4). How can I do this in Excel?
To get the month from A1, simply do, at B1
=(A1)
To get the quarter of A1, based on B1, I like to use this formula on C1:
=INT((B1-1)/3)+1
If you want a column that shows month names, use the following formula (you may have to use , instead of ;:
=TEXT(A1;"mmm")
One problem with this approach is that you can't use this formula on B1, or else the formula on C1 won't work. That is, unless you bypass B1 and have C1 referr directly to A1, like this:
=INT((MONTH(A1)-1)/3)+1

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