Pull named range from cell value - excel

I have a spreadsheet used to generate monthly job cards. I need to set it up so it "knows" which month it's on, and on which day number a Monday falls. To this end I have set it up that each day number for every monday this year is listed. Each line on the daily task jobcard is serial numbered from 1 to 28,30, or 31 dependant on the month, so I have set up a formula to check the serial number for the daily task against the day number of each Monday. It works and I have checked this, but the only issue I have is that the formula (=IF(COUNTIF(MARCH23MON,AJ6)>0,$AK$4,$AK$5)) requires me to change the MARCH23MON to match the range for each month up to 31 times every month.
Is there a way to do something like if the date = the date listed in cell a1, then use the value of cell b2 as the range (i.e. MARCH23MON).
See the screenshot here to see how I have begun to set this out. The date for each month is defined by the user in cell C3 when they generate the job cards for the upcoming month, this is then copied into cell AJ2 and formatted to match the dates in AP3:AP14.
I'd like to have the date defined in AJ2 to define the range the formula in AN6:AN36 uses from those listed in AO3:AO14, so that each month is checked against the relevant range of dates.
I had attempted to just use a vlookup then reference the output in this formula =IF(COUNTIF(MARCH23MON,AJ6)>0,$AK$4,$AK$5) as follows =IF(COUNTIF($AL$2,AJ6)>0,$AK$4,$AK$5) which obviously doesn't work. I tried it as ADDRESS($AL$2) but again no worky. Not sure if it is possible.

Foxfire and Burns And Burns mentioned the CHOOSE function in a comment, and that has resolved this for me. Instead of using the list of range names I am now using CHOOSE
to select the dates of each month's Mondays from individual lists. I get the value of AL2 from a VLOOKUP function.

Related

VLOOKUP to find weeknumber

I'm sure there is a more appropriate method for this, but I have layers of referencing so it has to be done this way. My spreadsheet is like an onion.
I need to be able to pull the week number based on a value defined in another sheet. So far the user enters the date when they start the sheet up. It is always the 1st of the month. This is then reference for a host of things elsewhere. This value is currently in =Front!$C$3. I have a visual calender set up as 53 rows, with 1 row per seven day period. I had written =VLOOKUP(O25, $S$2:$Z$54, 1, FALSE ) which had worked on a two column table for another task with different referencing. Currently I get #N/A as the return.
I'm assuming there is a way to have the cell check the red area for a value matching 1/1/23 (formatted as a custom format to just show the day number) and return the value in column 1 (the week number)
In my case O25:O36 is just 1/1/23:1/12/23. N25:N36 is the same just referencing the adjacent cell for O.
If there is a more straight forward way of having a cell return the weeknumber for the first day of each month, so I can have a cell on Front! return the week number based on the value in =Front!$C$3 that would be ideal also.
Thanks for the second time to #FoxfireAndBurnsAndBurns again, for pointing out a simple answer. ISOWEEKNUM with the dates of the first of the month has resolved.
=ISOWEEKNUM("1/1/23")

How to select a cell based on the current month in excel

I'm looking for some excel help.
I am trying to make a total cell that changes the value selected based on what month it currently is. Basically in the image the left cell indicates the $ amount for that month and that $ amount is in the cells on the right.
For example I want the total cell (not shown in the screenshot) to show 15363.21 from March 1 to 31st, and then change to 15388.81 on April 1st.
I have done some research but can't get this to work for me.
Pretending month is march Pretending month is April
It seems like you are asking for a lookup: "find the single cell in Column A that contains the current month and year, then return the corresponding single cell in Column F."
There are several ways to do this, but assuming your Excel version supports XLOOKUP, the code to place inside your total cell could be:
=XLOOKUP(1,(MONTH($A$4:$A$11)=MONTH(TODAY()))*(YEAR($A$4:$A$11)=YEAR(TODAY())),$F$4:$F$11)

Excel: Find if cell is >= or <= of an array of dates

I have made a dynamic calendar here: Please copy and paste for testing
The calendar currently uses VLOOKUP formulas (and more) to find guests checking into a property and lists information associated with their stay such as number of nights and their contact details. All of this is derived from a list shown to the right. Yes, it does contain
The date can be changed in cell B3 to the first of each month to view new guests checking in each month.
I now need to create conditional formatting formulas to alter the colour of the 3 cells spread across each day. You will see 7th December 2019 has the first cell in green, second white and 3rd red. I have created a formula to detect if the date (always right most cell) is contained in the range X5:AF13. This formula will not work if the check-in date is any other day than a Saturday. The 'prototype' formulas created so far are illustrated below.
I need to construct a new formula that will work so the date (07, 08, 09 etc) is searched against the occupied days/nights in the range X5:AF13 shown in pink. My proposed method is to cross reference (VLOOKUP) the date against the days/nights which the property is occupied for. I need to find the SUM([Date2]+[Nights]-1) to find the check-out date and somehow find if the date shown in the calendar is >= or <= to any of dates between check-on and check-on with the list in pink.
Is VLOOKUP the right forumla or is MATCH or even a combination with IF(AND( and SUM(? Slightly stuck...

Excel Date table to determine next Bi-annual date from Input date

I am creating a Table in excel to help determine what the Bi-annual dates would be from an input date.
Example: If the start date of an agreement is 9/1/2017 and Ends 8/31/2018, the Bi-annual dates would be 2/28/18 and 8/31/2018. Dates of service would be 2 months before the end of the agreement period, and six months before the second service date (so 6/30/2018 and 12/31/2017 respectively).
Formula for this:
=IF(ISBLANK(O3), "",IF(EOMONTH(A1, 0)=EOMONTH(O3, -2), "BIANNUAL", IF(EOMONTH(A1, 0)=EOMONTH(O3, -8), "BIANNUAL", "")))
Where A1 refers to January, B1 would be February, and so on thru to December (L1). O3 is the Agreement End Date box, and will be static on the sheet. This formula work perfect for me.
What I am trying to get is a formula for the cells at the top that list the months (Jan-Dec). I need a formula that will put the date as 1/31/2018 for Jan, 2/28/2018 for Feb, 9/30/2017 for September (for the current year since September has not passed). The actual day needs to be the last day of the month, and if that month has passed, then the year should be for next year. I have been playing with the DATE function, but cannot get it nailed down.
What I have so far - January 2018:
=DATE(YEAR(TODAY()+365), MONTH(42766), DAY(EOMONTH(42766, 0)))
This works, but not each month will be in 2018. I need the year to change only after the month has passed.
I feel like I'm either over complicating things, or I need a way more complex formula. Please help.
In A1 place the following formula and copy right to L1 or as far as you need to go
=EOMONTH($O$2,COLUMN(A1)-1)
It will display the end of month dates starting with the starting month of the contract and increasing by 1 month for each column you move right.
In the image below, it is the same formula in row 1 and row 2. Row one I choose custom format instead of date and set the custom format to mmmm. 4 m's will give you the full month, and 3 m's will give you the 3 starting letters of the month.
I actually figured this out this morning just playing with the IF function. My goal was to have the sheet update itself without having to change the dates every time your open it. So that the file could be shared with others and all you would have to enter is the end of the contract date, and it will list out Biannual, Tri-annual, and Quarterly months (see image).
Formula:
=IF(DATE(YEAR(TODAY()), MONTH(42766), DAY(EOMONTH(42766, 0)))<TODAY(), DATE(YEAR(TODAY()+365), MONTH(42766), DAY(EOMONTH(42766, 0))), DATE(YEAR(TODAY()), MONTH(42766), DAY(EOMONTH(42766, 0))))
Where I used the serial for each month (in this case 1/31/2017, as I didn't need to worry about the year)
Results

Calculate monthly average from daily data without PivotTable

My worksheet contains two columns: column A contains the date in the format dd/mm/yyyy and column B contains the daily data. From the daily data I have to generate the monthly average for each month without a PivotTable. Some of the days contain no data at all. I cannot use a PivotTable as I have to use the monthly average to identify outliers in the daily data at a later stage.
For this example it's important that I don't use a PivotTable and that I can generate the monthly average data for any month and year in my list. The solution can be an Excel formula or VBA.
Assuming you have the months in column D enter this formula in E2 and copy till last month
=AVERAGEIFS($B$1:$B$62,$A$1:$A$62,">="&D2,$A$1:$A$62,"<="&EOMONTH(D2,0))
Some of the days contain no data at all.
In case this means that there are no row for some dates and you want to calculate average based on full month than you can use the below formula:
Continuing with example given by EEM
=SUMIFS($B$1:$B$62,$A$1:$A$62,">="&D2,$A$1:$A$62,"<="&EOMONTH(D2,0))/DAY(EOMONTH(D2,0))
In case Daily Data contains some #N/A, one can add a additional criteria to skip non number data:
=AVERAGEIFS($B$1:$B$62,$A$1:$A$62,">="&D2,$A$1:$A$62,"<="&EOMONTH(D2,0),$B$1:$B$62,"<10E69")
Given a single date you can calculate both the End of the Month and the First of the Month for that date. Assume any given date is in E4:
For the End of the Month
=EOMONTH(E4,0)
For the First of the Month
=EOMONTH(EDATE(E4,-1),0)+1
If you place a date, any date, of the month you want to review into cell E4 the two above code snipets will give you and last and first days of the month. EDATE allows you to add and subtract whole numbers to change the month. We take one month away from the current month, found within the date in cell E4, and then find the end of the month and add a one to it to become the first day of the next month. It will work with any date. The below example shows grade averages over a month referencing any given date within the month.
Pic of the above Excel example
=AVERAGEIFS(C2:C11, B2:B11,">=" & EOMONTH(EDATE(E4,-1),0)+1, B2:B11,"<=" &EOMONTH(E4,0), A2:A11, E2)

Resources