Formula help

c_m

Well-known Member
Joined
May 29, 2008
Messages
836
I am trying to figure out a formula so that
for variable in cell C1 = 4 (for instance)
Input Output
1 1
2 2
3 3
4 1
5 2
6 3
7 4
8 1
9 2
10 3
11 4
12 1
and so on.
if C1 = 7 then the series would be
1,2,3,4,5,6,1,2,3,4,5,6,7,1,2,3,4,5,6,7...
any ideas on what the formula should be?

Thanks
 

Excel Facts

Quick Sum
Select a range of cells. The total appears in bottom right of Excel screen. Right-click total to add Max, Min, Count, Average.
This seems like a peculiar pattern to me... is it truly 1 through n-1 in the first grouping then 1 through n repeated? Or, was there a mistake where it should be 1 through n each time including the first group?
 
Upvote 0
Maybe try in cell B2 (assuming 1 is in B1):

=if(B1=C1,1,B1+1)

Then copy that down. Hope that helps.
 
Upvote 0
This seems like a peculiar pattern to me... is it truly 1 through n-1 in the first grouping then 1 through n repeated? Or, was there a mistake where it should be 1 through n each time including the first group?


there was no mistake in the output...the first group is from 1 to n-1 and rest from 1 to n.

So all I am looking for is...if i change n the output column updates automatically
 
Upvote 0
Assuming A1 down has 1,2,3,etc.....try this formula in B1 copied down

=MOD(A1-(A1<=C$1),C$1-(A1<=C$1))+1
 
Upvote 0
I believe this will work still based on B1 having 1 and C1 containing the number you specify:

=IF(B1=$C$1,1,IF(AND(B1+1=$C$1,COUNTIF($B$1:$B1,$C$1-1)=1),1,B1+1))
 
Upvote 0

Forum statistics

Threads
1,214,834
Messages
6,121,873
Members
449,056
Latest member
ruhulaminappu

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