Counting Formula

BrettOlbrys1

Board Regular
Joined
May 1, 2018
Messages
128
Office Version
  1. 365
Platform
  1. Windows
Based on a week date, I want to assign a "1" to that date. The dates greater than that date, I want the value to count up by +1 and the dates less than that date, I want them to count down by -1. My file is not static though because based on when the file is opened, the numbers assigned to the static dates will move. I need a formula that will assign the numbers above the dates.


If today was 4/19
-5-4-3-2-10123456789
3/83/153/223/294/54/124/194/265/35/105/175/245/316/76/14
If today was 5/10
-8-7-6-5-4-3-2-10123456
3/83/153/223/294/54/124/194/265/35/105/175/245/316/76/14
If today was 5/24
-10-9-8-7-6-5-4-3-2-101234
3/83/153/223/294/54/124/194/265/35/105/175/245/316/76/14
 
Book1
ABCDEFGHIJKLMNOPQRSTUVW
1-11-10-9-8-7-6-5-4-3-2-101234567891011
223-Feb-212-Mar-219-Mar-2116-Mar-2123-Mar-2130-Mar-216-Apr-2113-Apr-2120-Apr-2127-Apr-214-May-2111-May-2118-May-2125-May-211-Jun-218-Jun-2115-Jun-2122-Jun-2129-Jun-216-Jul-2113-Jul-2120-Jul-2127-Jul-21
3
4-11-10-9-8-7-6-5-4-3-2-101234567891011
516-Feb-2123-Feb-212-Mar-219-Mar-2116-Mar-2123-Mar-2130-Mar-216-Apr-2113-Apr-2120-Apr-2127-Apr-214-May-2111-May-2118-May-2125-May-211-Jun-218-Jun-2115-Jun-2122-Jun-2129-Jun-216-Jul-2113-Jul-2120-Jul-21
6
7
Sheet1
Cell Formulas
RangeFormula
A1:W1A1=(A2-TODAY())/7
A4:W4A4=(A5-TODAY())/7+1
Press CTRL+SHIFT+ENTER to enter array formulas.
 
Upvote 0

Excel Facts

Workdays for a market open Mon, Wed, Friday?
Yes! Use "0101011" for the weekend argument in NETWORKDAYS.INTL or WORKDAY.INTL. The 7 digits start on Monday. 1 means it is a weekend.
Let's try again. It is now 12 May here.

BTW, you never answered my question:


Here is (part of) my new Raw data sheet

BrettOlbrys1.xlsm
ABCDEFGHIJKLMNOPQRSTU
26/01/2113/01/2120/01/2127/01/213/02/2110/02/2117/02/2124/02/213/03/2110/03/2117/03/2124/03/2131/03/217/04/2114/04/2121/04/2128/04/215/05/2112/05/2119/05/2126/05/21
3data 1data 2data 3data 4data 5data 6data 7data 8data 9data 10data 11data 12data 13data 14data 15data 16data 17data 18data 19data 20data 21
4other 1other 2other 3other 4other 5other 6other 7other 8other 9other 10other 11other 12other 13other 14other 15other 16other 17other 18other 19other 20other 21
Raw data
Cell Formulas
RangeFormula
B2:U2B2=A2+7



The -84 in the formula below is the number of days to allow for 12 weeks of results.

BrettOlbrys1.xlsm
ABCDEFGHIJKLM
124/02/213/03/2110/03/2117/03/2124/03/2131/03/217/04/2114/04/2121/04/2128/04/215/05/2112/05/21
2data 8data 9data 10data 11data 12data 13data 14data 15data 16data 17data 18data 19
3other 8other 9other 10other 11other 12other 13other 14other 15other 16other 17other 18other 19
4
12 weeks
Cell Formulas
RangeFormula
A1:L3A1=FILTER('Raw data'!A2:AZ4,('Raw data'!A2:AZ2<=TODAY())*('Raw data'!A2:AZ2>TODAY()-84),"")
Dynamic array formulas.
Thanks Peter, this was the solution!
 
Upvote 0
Hello again. I'm back for another question on this same topic. I want to assign the number "1" to the CURRENT WEEK and it needs to be a WHOLE number, not a number with decimals because I am looking for an exact match to "1". The problem I have run into is that I have a range of weekly dates starting from 1/4/21 through 1/2/23 (each week range is 7 days greater than the previous week) and it is assigning "1" to the week of 2/1/21, not 1/31/22. The formula I have is:

=IFERROR(CHOOSE((WEEKNUM(CY5,2)-WEEKNUM(TODAY(),2)+2),0,1,2),"")

Row 5 contains the range of dates.

I tried another formula, but it gives me decimals across the assigned numbers, but I need whole numbers to do a match: =(CY5-TODAY())/7+1

What formula do I need that will assign a "1" to the current week where the "1" or whatever number (-1, 0, 1, 2, 3, etc.) will be WHOLE numbers?

Thanks

Brett
 
Upvote 0
It is a long time since the original question and your current question seems to have little to do with the post that you said was the solution to that.

Therefore could we have some fresh sample data and expected results for the new query (preferably with XL2BB) and explain again in relation to the new sample data?
 
Upvote 0

Forum statistics

Threads
1,215,615
Messages
6,125,857
Members
449,266
Latest member
davinroach

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top