+ Reply to Thread
Results 1 to 9 of 9

filling up cells automatically!!

  1. #1
    Registered User
    Join Date
    04-10-2008
    Location
    India
    MS-Off Ver
    MS2021
    Posts
    18

    filling up cells automatically!!

    Hi,

    I have the following problem,

    I have a two clumn numbers like this,

    1 5
    2 4
    3 8
    4 9
    5 3
    6 2
    ------
    ------
    ------
    168 2
    169 4.

    I want to fillup cels automatically with the numbers of column 1 with the times of corresponding column 2. Example, the number 1 of column should be filled up 5 times (as shown in column 2) like, 1 1 1 1 1 and 2 as 2 2 2 2 and so on. Ofcourse i could do it in perl using for loop. I dont have idea of programming in excel. Can anybody help me.

  2. #2
    Forum Moderator davesexcel's Avatar
    Join Date
    02-19-2006
    Location
    Regina
    MS-Off Ver
    MS 365
    Posts
    13,486
    Hi,
    Try this,
    =REPT(A1,B1)
    then copy the formula down

  3. #3
    Registered User
    Join Date
    04-10-2008
    Location
    India
    MS-Off Ver
    MS2021
    Posts
    18
    REPT function will repeat the text or cell value the number of times shown in the second column cell in a single cell only.

    like,

    1 4 will give 1 4 1111 but i want the repeated 1s should be posted in different cells. Actually my problem is the column one shows an agent id and the column two shows the number of gift coupons he got. we will take a lucky dip and give a bumper gift. for this i want to make lucky coupons on that agent id. from that we will select one agent.

  4. #4
    Forum Expert darkyam's Avatar
    Join Date
    03-05-2008
    Location
    Houston, TX
    MS-Off Ver
    2013
    Posts
    2,191
    =IF(Column()-2<=$B1,$A1,"") should work. Put this in C1, drag across as many columns as the max number in column B and drag down.

  5. #5
    Registered User
    Join Date
    04-10-2008
    Location
    India
    MS-Off Ver
    MS2021
    Posts
    18
    Thank you, but there is a problem in this formula.

    1. This is giving one number less repeats than required.
    example:
    if A1=1 and B1=5. Then A1 should be repeated 5 times, but it is giving 4
    times only.

    2. It is not giving any result when B=1. (as per your formula it is giving value
    B-1 times)...

    please modify.

  6. #6
    Forum Expert darkyam's Avatar
    Join Date
    03-05-2008
    Location
    Houston, TX
    MS-Off Ver
    2013
    Posts
    2,191
    I tested it and it works just fine for me. Did you type < instead of <=?

  7. #7
    Forum Moderator davesexcel's Avatar
    Join Date
    02-19-2006
    Location
    Regina
    MS-Off Ver
    MS 365
    Posts
    13,486
    Quote Originally Posted by visitnag
    Thank you, but there is a problem in this formula.

    1. This is giving one number less repeats than required.
    example:
    if A1=1 and B1=5. Then A1 should be repeated 5 times, but it is giving 4
    times only.

    2. It is not giving any result when B=1. (as per your formula it is giving value
    B-1 times)...

    please modify.
    Good morning
    darkyam's formula worked for me, do you have the formula extended far enough?

  8. #8
    Registered User
    Join Date
    04-10-2008
    Location
    India
    MS-Off Ver
    MS2021
    Posts
    18
    Nope! I just copied and pasted your formula....ofcourse i even re-wrote that , but it is giving 1 less... and no result when b=1. I am using excel-2007.

  9. #9
    Forum Expert darkyam's Avatar
    Join Date
    03-05-2008
    Location
    Houston, TX
    MS-Off Ver
    2013
    Posts
    2,191
    Could you please post your workbook then? Please save it as an xls, then zip it.

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1