+ Reply to Thread
Results 1 to 6 of 6

Stupid Fill range problem

  1. #1
    Registered User
    Join Date
    02-08-2007
    Posts
    5

    Stupid Fill range problem

    I appologize for any cross posts betweeen here and MS Excel Programming boards but I'm going nutz and am on a tight deadline. I'm building .csv file for import to an existing SQL database and have to fill a range of 735 rows with value that increment in a strange way.

    row 1 contains headers. columns A and C contain values. I need to populate Col B with values like the following starting at B2 and working down to B736

    B2 needs to read R2C3
    B3 needs to read R2C4
    B4 needs to read R2C5

    B5 needs to read R3C3
    B6 needs to read R3C4
    B7 needs to read R3C5

    B8 needs to read R4C3
    B9 needs to read R4C4
    B10 needs to read R4C5 ...etc.

    see the pattern?

    I was given...
    =OFFSET($C$4,INT((ROW(A1)-1)/3),MOD(ROW(A1)-1,3))

    But it's not working because of the values that I have in columns A and C. I've been banging my head with this for so long that I'm just not thinking straight.

    Any and all help is greatly appreciated and if you live anywhere near me I'll buy you a drink!

  2. #2
    Forum Expert
    Join Date
    12-29-2004
    Location
    Michigan, USA
    MS-Off Ver
    2013
    Posts
    2,208
    It looks like you just need to change $C$4 to $C$2.
    Last edited by jasoncw; 02-08-2007 at 05:06 PM.

  3. #3
    Registered User
    Join Date
    02-08-2007
    Posts
    5

    no good

    changing
    =OFFSET($C$4,INT((ROW(A1)-1)/3),MOD(ROW(A1)-1,3))
    to
    =OFFSET($C$2,INT((ROW(A1)-1)/3),MOD(ROW(A1)-1,3))
    produces P

    there are reoccuring values in Column C
    C2= P
    C3=1
    C4=C
    C5=P
    C6=1
    C7=C

    and so on down the line.

    My original thought was that what I'm looking to have accomplished needs to be setup in a macro.

    Please keep helping me pound away at this.

  4. #4
    Forum Expert
    Join Date
    12-29-2004
    Location
    Michigan, USA
    MS-Off Ver
    2013
    Posts
    2,208
    Quote Originally Posted by tourless
    changing
    =OFFSET($C$4,INT((ROW(A1)-1)/3),MOD(ROW(A1)-1,3))
    to
    =OFFSET($C$2,INT((ROW(A1)-1)/3),MOD(ROW(A1)-1,3))
    produces P

    there are reoccuring values in Column C
    C2= P
    Isn't that what you are looking for? Cell B2 has the value "P", which is in cell C2, or R2C3. If you copy this formula down, it appears to work as you are intending. Maybe I am interpreting your request incorrectly?

  5. #5
    Registered User
    Join Date
    02-08-2007
    Posts
    5
    I think so...

    The values in column B are going to refer to output placeholders (for lack of a better term) when the DB is queried. The values basically mean, place info in row 2 column 3, row 2 column 4, etc.

    I'mnot trying to get reference values from any other cells just simply populate column B from row 2 through row 736 in the sequence described above.

    The end result should be that the last row (736 in column B) would read...
    R246C5

    that's why I originally thought a macro which could perhaps take a static text value "R" and concat it with a repeating numberic value "3,3,3,4,4,4,etc." concat with another text value "C" and finally concat with "3,4,5,3,4,5" over and over again until I reach the final row (736)

    I hope I'm making myself clearer it' sort of difficult to describe.

    I do appreciate all your time and assistance with this. I can use all the help I can get!

  6. #6
    Registered User
    Join Date
    02-08-2007
    Posts
    5
    Sub test()
    Row = 2
    a = 2
    Do
    For i = 3 To 5
    Cells(Row, 2).Value = "R" & a & "C" & i
    Row = Row + 1
    Next i
    a = a + 1
    Loop Until Row >= 735
    End Sub


    This is what did it!!!

    I needed to be taken literally!!!

+ 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