Kanwaljit Singh Dhunna

asked on

# Insert Rows and copy data

Dear Experts,

Kindly find an excel File attached.

I need to insert blank rows below each row based on a formula.

Then only non-blank data needs to be copied from Range1 to Range2

The File will clear everything.

Regards

EEE.xls

Kindly find an excel File attached.

I need to insert blank rows below each row based on a formula.

Then only non-blank data needs to be copied from Range1 to Range2

The File will clear everything.

Regards

EEE.xls

ASKER

Hi Saqib,

Only the Data.

Colour are only to show what data was copied where.

Thanks

Only the Data.

Colour are only to show what data was copied where.

Thanks

ASKER

Hi Saqib,

R u there ?

R u there ?

yes

ASKER CERTIFIED SOLUTION

membership

Create a free account to see this answer

Signing up is free and takes 30 seconds.

**No credit card required.**ASKER

Dear Saqib,

You certainly have done a lot of hard work and it seems to be paying off. Give me some time to try it.

Regards

Kanwal

You certainly have done a lot of hard work and it seems to be paying off. Give me some time to try it.

Regards

Kanwal

Main intezaar karoonga

ASKER

Dear Saqib Bhai,

You have done a GREAT Job !

Thanks and Best of Luck to Dear Pakistan for the Indo Pak Semifinal

You have done a GREAT Job !

Thanks and Best of Luck to Dear Pakistan for the Indo Pak Semifinal

ASKER

Dear Saqib,

It indeed was a unique solution. I am also going to post the same question to try some VBA solution. You are welcome there too.

Regards

Kanwal

It indeed was a unique solution. I am also going to post the same question to try some VBA solution. You are welcome there too.

Regards

Kanwal

ASKER

Dear Saqib,

Though I have customized the formula to suit my requirements, but I am still intrigued by the finesse and would like to have a word from you about what the formulae are doing (Off course when you have time). I have seen in the past too producing you amazing formula and standard seems to have risen a lot.

Regards

Kanwal

Though I have customized the formula to suit my requirements, but I am still intrigued by the finesse and would like to have a word from you about what the formulae are doing (Off course when you have time). I have seen in the past too producing you amazing formula and standard seems to have risen a lot.

Regards

Kanwal

********** CCOONNGGRRAATTUULLAATTIIOONNSS *********

ASKER

Thanks Saqib,

I know for what it is :)

But I heartily appreciate the fighting spirit shown by the Pak team to reach last 4. Today was just not their day. Till Mis-bah was there, everyone feared that he would take the Game away. Any way Hard luck this time. Best of luck for the future.

Regards

kanwal

I know for what it is :)

But I heartily appreciate the fighting spirit shown by the Pak team to reach last 4. Today was just not their day. Till Mis-bah was there, everyone feared that he would take the Game away. Any way Hard luck this time. Best of luck for the future.

Regards

kanwal

ASKER

And yours formula is working wonders but I still couldn't fully grasp it...... Do drop a hint whenever you got the mood to do it.

A game should be treated as a game and not a matter of pride. One team has to win and the other has to lose. The only thing that matters is that it should be a good game played with sincerity.

Which formula are you referring to? Just ask what you want to know.

Which formula are you referring to? Just ask what you want to know.

ASKER

Ditto.... I Agree.

Game is a game and emotions should be attached to the game only.

I am referring to the formula used by you in the file provided here. You seem to have used only two formulas to do a seemingly difficult task.

Game is a game and emotions should be attached to the game only.

I am referring to the formula used by you in the file provided here. You seem to have used only two formulas to do a seemingly difficult task.

Column A

=IF(ISNUMBER(A1),

IF(COUNTIF($A$1:A1,A1)<=OFFSET(INDIRECT(ADDRESS(ROW(MyRange),COLUMN(MyRange),,,"sheet1")),A1,33),

Sheet2!A1,

Sheet2!A1+1),

1)

Each entry in this column depends upon the entry in its previous row. Either it repeats the previous entry or it adds 1 to it. Except for the first row where it must be 1.

Now to check whether to add 1 or not, I count the previous value in all the rows above the previous one and if it is not equal to the value found in the AH Column of sheet1 then keep the previous value. If it is equal then add 1

B to K

=IF(COUNTIF($A$1:$A2,$A2)=1,

IF(OFFSET(INDIRECT(ADDRESS(ROW(MyRange),COLUMN(MyRange),,,"sheet1")),$A2,-1+COLUMN())="",

"",

OFFSET(INDIRECT(ADDRESS(ROW(MyRange),COLUMN(MyRange),,,"sheet1")),$A2,-1+COLUMN())),

"")

If there is only one instance of the number in column A above and including the current row then print the value from sheet 1 otherwise leave blank.

L to N

=INDEX(Sheet1!$1:$1,

0,

SMALL(IF(OFFSET(Sheet1!$L$2,$A2,0,1,22)=0,

99,

COLUMN(OFFSET(Sheet1!$L$2,$A2,0,1,22))),

COUNTIF($A$1:$A2,$A2)))

This is an array formula and creates an array of column numbers where it finds a value. Then it uses the small to find the nth smallest number in this list.

I am sure this is not going to be sufficient to explain it all to you. But to get more out of me you would have to ask specific questions and I shall be glad to respond.

=IF(ISNUMBER(A1),

IF(COUNTIF($A$1:A1,A1)<=OF

Sheet2!A1,

Sheet2!A1+1),

1)

Each entry in this column depends upon the entry in its previous row. Either it repeats the previous entry or it adds 1 to it. Except for the first row where it must be 1.

Now to check whether to add 1 or not, I count the previous value in all the rows above the previous one and if it is not equal to the value found in the AH Column of sheet1 then keep the previous value. If it is equal then add 1

B to K

=IF(COUNTIF($A$1:$A2,$A2)=

IF(OFFSET(INDIRECT(ADDRESS

"",

OFFSET(INDIRECT(ADDRESS(RO

"")

If there is only one instance of the number in column A above and including the current row then print the value from sheet 1 otherwise leave blank.

L to N

=INDEX(Sheet1!$1:$1,

0,

SMALL(IF(OFFSET(Sheet1!$L$

99,

COLUMN(OFFSET(Sheet1!$L$2,

COUNTIF($A$1:$A2,$A2)))

This is an array formula and creates an array of column numbers where it finds a value. Then it uses the small to find the nth smallest number in this list.

I am sure this is not going to be sufficient to explain it all to you. But to get more out of me you would have to ask specific questions and I shall be glad to respond.

Saqib