formula required

I

Igneshwara reddy

Hi,

I have a data in column A for 800 lines.

Column A Column B Column C Column D Column E
123 3 123-002 123-003 123-004
432 2 432-002 432-003

As defined above, the data what I have in Column A should be counted the
number of times in Column B and it has to repeated so many times in different
columns with the sequence of 002, 003 004 etc., The sequence should start
only from 002 and should continue to the number of times it has to be
repeated.

Please help me out.

Regards,
Igneshwara Reddy.
 
L

Lars-Åke Aspelin

Hi,

I have a data in column A for 800 lines.

Column A Column B Column C Column D Column E
123 3 123-002 123-003 123-004
432 2 432-002 432-003

As defined above, the data what I have in Column A should be counted the
number of times in Column B and it has to repeated so many times in different
columns with the sequence of 002, 003 004 etc., The sequence should start
only from 002 and should continue to the number of times it has to be
repeated.

Please help me out.

Regards,
Igneshwara Reddy.


Try the following formula in cell C2

=IF($B2>COLUMN()-2,$A2&"-"&RIGHT("000"&COLUMN()-1,3),"")

Copy cell C2 as far to the right as needed to cover the maximum times.
Then copy down from row 2 to row 801.

Hope this helps / Lars-Åke
 
L

Lars-Åke Aspelin

Actually not, as I believe the OP want the xxx-002 to appear in
column C and so on.
Maybe it is confusing to have COLUMN()-2 in one place and COLUMN()-1
in another place. But if you change > to >= then you also have to
change the COLUMN()-2 to COLUMN()-1. I think...

/ Lars-Åke
 
R

Ron Rosenfeld

Hi,

I have a data in column A for 800 lines.

Column A Column B Column C Column D Column E
123 3 123-002 123-003 123-004
432 2 432-002 432-003

As defined above, the data what I have in Column A should be counted the
number of times in Column B and it has to repeated so many times in different
columns with the sequence of 002, 003 004 etc., The sequence should start
only from 002 and should continue to the number of times it has to be
repeated.

Please help me out.

Regards,
Igneshwara Reddy.

If your data starts in row 1, then:

C1: =IF(COLUMNS($A:A)>$B1,"",$A1&TEXT(COLUMNS($A:A)+1,"\-000"))

Fill right as far as required. The select C1:Cn and fill Down as far as
required.
--ron
 
L

Lars-Åke Aspelin

Yes, you are right. The tweak is indeed needed in order to get the
correct number of repetitions, Thanks for the correction Max.

/ Lars-Åke
 
R

Ron Rosenfeld

If your data starts in row 1, then:

C1: =IF(COLUMNS($A:A)>$B1,"",$A1&TEXT(COLUMNS($A:A)+1,"\-000"))

Fill right as far as required. The select C1:Cn and fill Down as far as
required.
--ron

One note:

The use of COLUMNS($A:A) vs using COLUMN() as a method to generate the serial
numbers will behave differently if you should Insert a column.

e.g:

=IF(COLUMNS($A:A)>$B1,"",$A1&TEXT(COLUMNS($A:A)+1,"\-000"))
or
=IF((COLUMN()-2)>$B1,"",$A1&TEXT(COLUMN()-1,"\-000"))

Using the first method, the result of the calculation will be unchanged; using
the second, the result of the calculation will change depending on the column
number after the insertion.

Which is "better" depends on your specifications for what should happen in this
instance.
--ron
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads

Counting Column 3
Frequency Question 10
Excel Problem 2
Data Matching 2
Fill down 4
vlookfunction help 4
Find data in columns, then place in rows 2
sum column a if column b, c, d, and e are equal 4

Top