incrementing by 1

L

Legacy 4302

Guest
hi

For Each cl In [Sheet2!A1:C5]
tmpvalue = cl.value
if tmpvalue = 0 then tmpvalue=10
Worksheets("SHEET3").Cells(tmpvalue, cl.Column) = "1"
Next cl


this formula works great. Sheet 2 column A has: cell a1=2,cell a2=4,and cell a3=0 then sheet 3 column A has: a2="1", cell a4="1" and cell a10="1"
which is correct however the problem is if sheet 2 column a has:
cell a1= 3,cell a2=3 ,and a3=4
then sheet three column A should be cell a3="2" and cell a4="1"

so in other words if sheet 2 has duplicating numbers in the column then
for each instance of a duplicate number ,cl.value would have to be incremented by 1

thanks for any help

lneilson
 

Excel Facts

What is =ROMAN(40) in Excel?
The Roman numeral for 40 is XL. Bill "MrExcel" Jelen's 40th book was called MrExcel XL.
Master Excel Bundle

Excel contains over 450 functions, with more added every year. That’s a huge number, so where should you start? Right here with this bundle.

Forum statistics

Threads
1,167,991
Messages
5,856,684
Members
431,828
Latest member
kARTIK12345

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
Top