Filling the ALTERNATE rows with sequential number (1, 2,3 ..

aabbasi

Board Regular
Joined
Mar 4, 2002
Messages
188
Is there a way to tell Excel to number the rows from 1 to 100. The only problem is that I want Excel to put this information in alternate rows. For example: A1=1, A2=none A3=2 A4=none A5=3 A6=none

Thank you
 

Excel Facts

Which lookup functions find a value equal or greater than the lookup value?
MATCH uses -1 to find larger value (lookup table must be sorted ZA). XLOOKUP uses 1 to find values greater and does not need to be sorted.
Hi,

Put a 1 in A1. In A3 put the following:

=IF(MOD(ROW(),2),A1+1,"")

& copy down.

paddy
 
Upvote 0
Thank you for your response. However, when I followed your instructions, I got the following. Also if possible please explain me the function of MOD. Thanks

A1:1
A2:
A3:
A4:2
A5:
A6: #VALUE!
A7:
A8:#VALUE!
 
Upvote 0
You could put
=IF(MOD(ROW(),2),(ROW()+1)/2,"")
in row 1 and copy it down
(or the opposite
=IF(MOD(ROW(),2)=0,ROW()/2,"")

Mod simply returns the remainder. For example in row 3, it would return a 1 since 2 goes into 3 once with a remainder of 1. This is just used to check for even or odd rows. Excel interprets 0 as false, and a positve number as true.
 
Upvote 0
Hi - works for me! See the example:
Book9
ABCD
11
2
32
4 
53
6 
74
8 
95
10 
116
12 
137
Sheet1


i.e.
A1 - enter a 1
A2 - leave blank
A3 - enter the formula & copy down..

=IF(MOD(ROW(),2),A1+1,"")

row() / 2
If the row number / 2 leaves a remainder, then the row number is odd.
mod(row(),2) returns the remainder of the row() / 2 calculation.
It's use in the if() can be 'expressed' roughly as follows:

if the row number divided by 2 gives us anything, add 1 to A1, otherwise nothing.

(This works because excel will treat 0 as false and other numbers as true, which can be exploited within the true / false checking of the if statement).

Paddy
 
Upvote 0
IML and Paddy: Thank you very much for giving me the solution. Paddy special thanks to you for explaining MOD function.

Have a nice evening!

regards,
aabbasi
 
Upvote 0

Forum statistics

Threads
1,213,484
Messages
6,113,923
Members
448,533
Latest member
thietbibeboiwasaco

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