You can make a difference in the Apple Support Community!

When you sign up with your Apple Account, you can provide valuable feedback to other community members by upvoting helpful replies and User Tips.

Looks like no one’s replied in a while. To start the conversation again, simply ask a new question.

Finding a date between Start and End dates

My columns have a start date cell and end date cell, spanning 1 week each column. My recurring items have numbered days, ie 'always on the 12th...', that I need to populate a price or supply number in the intersecting cell as the year progresses. I've been manually entering these as I expand the year, but that has grown too large to scroll and enter 1200+ cells by hand....

I'd like a copy-paste function that checks the date range to paste the order value, or stays blank.


I use Numbers a lot, but I'm very amateur in functions.




Posted on Nov 30, 2022 10:55 AM

Reply
Question marked as Top-ranking reply

Posted on Nov 30, 2022 10:07 PM

OOPS!


In a bit of a rush earlier, and didn't proof read before posting. Edited version below.


Rows 1, 2 and 3 are Header Rows. Columns A, B and C are Header columns.

I started with text entries in cells B1, C1, A2 and A3, following your model.


In the first round, I also set the data format in D1 to L1 to Text, and entered the month names as shown, but later changed the entries in the D1:L3 block to a single entry in D2, and a set of formulas to calculate the values shown in this block.


ALL entries in this block contain Date and Time values, with the Time part omitted (and automatically set to 00:00:00 (midnight, at the beginning of the date in the date part.


The Date, December 2 was entered in cell D2. Numbers set the year value to the current year, 2022, and added the Time part, setting it to 00:00:00 (as noted above)

With the Date entered, I set the data format of the cell to display only the month (12) and Day (2), separated by a hyphen. A slash (/) can be used in place of the hyphen, if desired.


Cell D1 contains a simple formula that copies the Date and Time value in D2, and is formatted to show only the Month name, as a three letter short value.


Cell D3 contains another formula that gets the Date and Time value from D2, then adds 6 to it. The 6 is interpreted as 'six days', and the result is the last day of the 'week' as described in your post.


In Column E:


Cell E2: D2+7

This ups the value in the next column to the first day date of that week.


Cells E1 and E3: Select the cell in the same row of column D, and fill it right into column E. Do this only with E1, then with E2.


With formulas (and their results) in all three rows of column E, Select the three cells then hover the pointer near the right edge of E2. When the Fill control (small yellow-filled circle) appears, grab it with the pointer and drag right to fill all three formulas into rows 1, 2 and 3 of the table.


The instructions set the values in the Header rows. Below the Header Rows, the Header columns (A, B and C) contain only entered values.


The Body of the table (D4:L10 in the sample) has only one formula, entered in cell D4, then filled right to column L and Down to row 10.


The formula, as entered in D4, is s


hown below the table in the example below, and described briefly in the text below the illustration.


IF(AND(DAY(D$2)≤$B4,DAY(D$3)≥$B4),$C4,"")


The formula is entered in the selected cell, D4, then filled down to the bottom of the table (as many rows as needed) and filled right for as many weeks as needed.


Apologies for the repetition!


Regards,

Barry

Similar questions

3 replies
Question marked as Top-ranking reply

Nov 30, 2022 10:07 PM in response to Barry

OOPS!


In a bit of a rush earlier, and didn't proof read before posting. Edited version below.


Rows 1, 2 and 3 are Header Rows. Columns A, B and C are Header columns.

I started with text entries in cells B1, C1, A2 and A3, following your model.


In the first round, I also set the data format in D1 to L1 to Text, and entered the month names as shown, but later changed the entries in the D1:L3 block to a single entry in D2, and a set of formulas to calculate the values shown in this block.


ALL entries in this block contain Date and Time values, with the Time part omitted (and automatically set to 00:00:00 (midnight, at the beginning of the date in the date part.


The Date, December 2 was entered in cell D2. Numbers set the year value to the current year, 2022, and added the Time part, setting it to 00:00:00 (as noted above)

With the Date entered, I set the data format of the cell to display only the month (12) and Day (2), separated by a hyphen. A slash (/) can be used in place of the hyphen, if desired.


Cell D1 contains a simple formula that copies the Date and Time value in D2, and is formatted to show only the Month name, as a three letter short value.


Cell D3 contains another formula that gets the Date and Time value from D2, then adds 6 to it. The 6 is interpreted as 'six days', and the result is the last day of the 'week' as described in your post.


In Column E:


Cell E2: D2+7

This ups the value in the next column to the first day date of that week.


Cells E1 and E3: Select the cell in the same row of column D, and fill it right into column E. Do this only with E1, then with E2.


With formulas (and their results) in all three rows of column E, Select the three cells then hover the pointer near the right edge of E2. When the Fill control (small yellow-filled circle) appears, grab it with the pointer and drag right to fill all three formulas into rows 1, 2 and 3 of the table.


The instructions set the values in the Header rows. Below the Header Rows, the Header columns (A, B and C) contain only entered values.


The Body of the table (D4:L10 in the sample) has only one formula, entered in cell D4, then filled right to column L and Down to row 10.


The formula, as entered in D4, is s


hown below the table in the example below, and described briefly in the text below the illustration.


IF(AND(DAY(D$2)≤$B4,DAY(D$3)≥$B4),$C4,"")


The formula is entered in the selected cell, D4, then filled down to the bottom of the table (as many rows as needed) and filled right for as many weeks as needed.


Apologies for the repetition!


Regards,

Barry

Nov 30, 2022 7:43 PM in response to DWChristopher




IF(AND(DAY(D$2)≤$B4,DAY(D$3)≥$B4),$C4,"")


The formula is entered in the selected cell, D4, then filled down to the bottom pf the table (as many rows as needed) and filled right for as many weeks as needed.


Values in Row 1 are all text, and entered manually. It is possible to extract the month name from the Date and Time values in the same column of row 2, but for the example, I wanted to concentrate on the more complicated formula in row 4 and below.


The first day value in D4 is entered as a Date and Time value, with the Time part omitted, and is formatted to display only the month name as a three letter value.


E2 contains this formula:

D3 contains this similar formula:


Both of these are filled right to the last column.


Regards,

Barry

Dec 1, 2022 12:05 AM in response to Barry

That is a beautiful thing! This sheet started out very simple, but has grown to an absolute monster over the years. Well, monster for amateur me, that is.


I applied the string from your first reply and adjusted the cell locations and locks, and it worked perfectly. I didn't notice the additional explanation until I had already tried it and filled both in columns and rows. In both my example and my actual sheet, the D2 format I've used is Date & Time in "1/5" format. The DAY function still worked perfectly. This was a huge blessing for me bc when the year rolls over, I expand out another 53 weeks, copy the D2 & D3 cells, and then paste the entire year. The months and days come out right on track, and I believe it even kept up with the leap year in 2020, so no manual entry.


This really is fantastic, Thank you Barry. I can't help but shake my head at the number of times I went reading through all of the function descriptions and didn't catch the simple idea of greater than/less than after returning the day number...

Finding a date between Start and End dates

Welcome to Apple Support Community
A forum where Apple customers help each other with their products. Get started with your Apple Account.