VLOOKUP to find weeknumber - excel

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

Related

Pull named range from cell value

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.

How to use the current time & date to display specific value?

I'm trying to set up an excel sheet which displays the name of the person available at the current time and date. I have one sheet with a list of dates and times along with the persons name who is available at that time. For example:
- 01/07/19 09:00 Bob
- 01/07/19 10:00 Bill
- 01/07/19 11:00 Ben
I can do this successfully for a full day or week using the WEEKNUM or DAYNUM functions, and the week/day number listed against the list of names.
I can use NOW() to get the current date and time, but I'm unsure how I can use this to get the desired results.
I've tried searching online for the answer but have been unable to find what I'm looking for.
Based on my example above, if the current time is between 9:00 & 10:00 I want the name Bill to be displayed.
Based on your dates being actual dates stored as number for excel and not numbers stored as text, and same for time, then the following solution should work for you. You can test your data to see if its an actual date using:
=ISNUMBER(A2) `where A2 is the cell in question
If the formula returns true then you know your are dealing with a number that has been formatted to display as a date or time.
As a side note, dates are stored as integers and are the number of days since 1900/01/01 with that date being 1. Time is stored as a decimal representing the portion of the day. 0.5 would be 12 noon.
This solution assumes the data is layed out as per the image below.
In cell F1, place your NOW() function. I have manually entered the date to control the value for demonstration purposes.
In cell F2 enter the following formula:
=INDEX(C:C,AGGREGATE(15,6,ROW($A$2:$A$4)/((INT($F$1)=$A$2:$A$4)*(MOD($F$1,1)<=$B$2:$B$4)),1))
AGGREGATE will make a list or all row number and sort them from largest to smallest. All Those row numbers will be divided by your criteria checks. If your criteria results are ALL True, then the row is divided by 1 and remains unchanged. If a criteria is not met the Row number is divided by 0 which causes an error. The 6 in the function tells aggregate to ignore error results. So you wind up with a list or row numbers that march your criteria. The 15 in aggregate tells aggregate to sort the row numbers from largest to smallest. The 1 tells aggregate to return the row number in position 1 of the sorted list. Aggregate then passes that row number to INDEX which finds the row in the corresponding column and returns the address of that cell.
now just so you are aware. The break point for time was set so that the person beside the list time is the one that will be picked when that exact time is provided. Meaning for a time of 0900 on the specified day, Bob would be selected. At 10:00:01 Ben will be selected. At 11:00:01 an error will be generated. you can control this by placing the whole thing in an IFERROR function. At 00:00:00 Bob is selected.
I believe this will do what you want:
=INDEX(C2:C4,MATCH(NOW()-TODAY(),B2:B4,1))
Where column C contains the names and column B the times
If date and time are in one column, you can try:
=INDEX(B1:B3,MATCH(NOW(),A1:A3,1))
Where column B contains the names and column A the date and time
Here is one way:
Formula in F1:
=INDEX(C2:C4,MATCH(1,INDEX((A2:A4=TODAY())*(HOUR(B2:B4)<=HOUR(NOW()))*(HOUR(B2:B4)>=HOUR(NOW())),0,1),0))
What's happening? We use MATCH to get the first TRUE in an INDEX list that compares column A against TODAY times column B for HOUR.
We can leave out the second INDEX but that would make it an array formula to be entered through CtrlShiftEnter
Note that this example is made around 9:30 on the 4th of July.

Guide me Regarding Compare the Value of Cell contain date and other cell contain Drop down list

Hy Every One, I need help in excel formula, I have two sheets, sheet1 for sale tracker, sheet two for goals tracker, I used Now() to enter date automatically, and its working fine, Next in goal sheet, I use =Sumif() to calcualte various category totals and refer them in cell. Its also working fine. But I want to track record according to month and category. Like I have 6 categories detail is as under,
Sales Tracker
In the First picture Column Date consist of formula "=IF(ISBLANK(B5),"-",TODAY())" and it display the name of month like "October"
While in second picture there is a drop down list of "Month" Column.
1- I want to use if statement like =if(Date=Month, Sum(Revenue Secure column Data), "-") But its not working the formula I wrote here is an example....
2- I want when I select any month from second sheet like January, February, It should calculate sum from picutre one data and only show the sum of january etc.
Please help me, this is eating my brain a huge,,,,,,:)
Thanks in advance....
In short my question is how can I use If statement to compare value of cell that contain formula and other that contain drop down list?
Or use the MONTH function to change your date to a number 1 to 12 corresponding to the month. Then have the combo return a number for the month chosen. It might be faster using integers than test
I Believe you have to compare the month and not the whole date.
You can do TEXT(NOW();"mmmm") to get the full month name of the current data (in the language of excel) and then compare it to your drop down.
If you replace the NOW() with any data it works as well.

How to show a value in one cell when current week is in another cell in excel

My first time to this forum.
I am a free range poultry farmer and I am trying to make spreadsheets to monitor my flocks. I have made the flock specific input sheets and now working on getting information for all of them into one summary sheet.
My question is...
I have the age of the birds going down column A also I have dates by week end date going down Column B... I would like to know how to have it that in one summary cell when the current date falls into one of the weeks listed in Column B that the corresponding cell in Column A is shown in that Summary cell (showing the current age of the flock). I would like this obviously auto update when the date progresses into another week.
Can any one help??
Thanks
Put the current date in the header (=TODAY() function or variations).
Name the current date cell (e.g. Current_date)
If your data are in table format I recommend putting them in a Table, this will insert your formulae to any new row started. If you dislike them you can simply create filters.
Use the formula in say C5 "=B5=Current_date" This will give you a logical expression, TRUE or FALSE. You can filter for TRUE to see the flocks to sell/cut.

Month-to-date totals

I have an Excel workbook that has several different worksheets in it. The one worksheet that contains the main data has 100's of entries. This sheet also gets a new entry every day in the row column. The first column is the date column that is formatted as date and time.
I need a formula that checks the newest entry's date to see if its month matches the current month and then sums all entries for that month. I know that I am going to use a SUMIF but the hard part is the rest of the formula. I forgot to mention that I need the formula to divide by the number of current month entries used.
Assuming your dates are in A1:A26 and amounts to be summed are in in B1:B26 here is the formula to use.
=SUMIFS(B1:B26,A1:A26,">="&DATE(YEAR(TODAY()),MONTH(TODAY()),1),A1:A26,"<="&TODAY())
This returns the amounts that are in a date that is greater than or equal to the first day of the current month, AND less than or equal to TODAY.
There are a couple ways you could do this and I would suggest using sumproduct formula.
I'm assuming your data has dates in column A starting in row 2, and a value in column B.
In column C you could have a total in each line which is the sum of all rows above the current one that the month matches.
Formula in C2 would be below which can be carried down
=SUMPRODUCT(--(MONTH(A2)=MONTH($A$2:A2)),$B$2:B2)
Otherwise if you have a single cell and just want to get the latest total this formula would do it. This assumes the latest entry will also be the newest date (highest value)
=SUMPRODUCT(--(MONTH(MAX(A:A))=MONTH(A2:A1000)),B2:B1000)
In sumproduct the first part of the formula --(A=B) returns true or false values which equate to 1s and 0s. The second part is just your value columns.
The second formula does the same thing but it compares the month of the newest date to all others in the column.
Gordon
Since new entries are added daily I am assuming these are in date order ascending, so please try:
=SUMIF(A:A,">"&EOMONTH(TODAY(),-1),AD1:AD100)
or adjust the AD range to suit (could use AD:AD).

Resources