+ Reply to Thread
Results 1 to 24 of 24

Increment column address while copying formula down

  1. #1
    Registered User
    Join Date
    04-27-2014
    Location
    england
    MS-Off Ver
    Excel 2010
    Posts
    10

    Increment column address while copying formula down

    I am creating a training document for work; the sheet I'm creating is a summary sheet which works out how many people answered questions correctly, incorrectly (bringing in from another sheet), number of questions answered and percentage of correct answers.

    Looks like:
    Correct: =COUNTIF(sheet1!E2:E36,"correct")
    Incorrect: =COUNTIF(sheet1!E2:E36,"incorrect")
    Number of questions answered: =SUM(C4+C5) (correct+incorrect)
    Percentage right: =SUM(C4/C6) (correct/number answered)

    I need to drag these 4 formulas down into another 400+rows, however in the correct and incorrect formulas I need it to keep the 2:36 but change the e to f, g, h, etc…
    Is this possible? Thanks
    Last edited by needhelp93; 04-27-2014 at 06:19 AM.

  2. #2
    Forum Expert Tony Valko's Avatar
    Join Date
    12-31-2011
    Location
    Pittsburgh
    MS-Off Ver
    2002, 2007:2013
    Posts
    18,890

    Re: Need help with a formula

    Try something like these...

    Assume the first formulas are entered in A1 and B1 then copied down.

    =COUNTIF(INDEX(sheet1!E$2:H$36,0,ROWS(A$1:A1)),"correct")

    =COUNTIF(INDEX(sheet1!E$2:H$36,0,ROWS(B$1:B1)),"incorrect")


    On a side note...

    The forum owner doesn't like ambiguous thread titles such as "Need help with a formula".

    Please change the thread title to something more specific.

    A moderator is sure to come by and "yell" at you!
    Last edited by Tony Valko; 04-27-2014 at 05:58 AM.
    Biff
    Microsoft MVP Excel
    Keep It Simple Stupid

    Let's Go Pens. We Want The Cup.

  3. #3
    Forum Moderator - RIP Richard Buttrey's Avatar
    Join Date
    01-14-2008
    Location
    Stockton Heath, Cheshire, UK
    MS-Off Ver
    Office 365, Excel for Windows 2010 & Excel for Mac
    Posts
    29,464

    Re: Need help with a formula

    Hi and welcome to the forum. Unfortunately your post does not comply with Rule 1 of our Forum RULES. Your post title should accurately and concisely describe your problem.

    Use terms appropriate to a Google search. Poor thread titles, like Please Help, Urgent, Need Help, Formula Problem, Code Problem, and Need Advice will be addressed according to the OP's experience in the forum: If you have less than 10 posts, expect (and respond to) a request to change your thread title. If you have 10 or more posts, expect your post to be locked, so you can start a new thread with an appropriate title.

    To change a Title on your post, click EDIT then Go Advanced and change your title, if 2 days have passed ask a moderator to do it for you.

    (This thread should receive no further responses until this moderation request is fulfilled, as per Forum Rule 7)
    Richard Buttrey

    RIP - d. 06/10/2022

    If any of the responses have helped then please consider rating them by clicking the small star icon below the post.

  4. #4
    Forum Expert Tony Valko's Avatar
    Join Date
    12-31-2011
    Location
    Pittsburgh
    MS-Off Ver
    2002, 2007:2013
    Posts
    18,890

    Re: Need help with a formula

    A suitable thread title could be something like:

    Increment column address while copying formula down

  5. #5
    Registered User
    Join Date
    04-27-2014
    Location
    england
    MS-Off Ver
    Excel 2010
    Posts
    10

    Re: Increment column address while copying formula down

    cheers Tony Valko. Title sorted, sorry...

  6. #6
    Registered User
    Join Date
    04-27-2014
    Location
    england
    MS-Off Ver
    Excel 2010
    Posts
    10

    Re: Increment column address while copying formula down

    not working

  7. #7
    Forum Guru sktneer's Avatar
    Join Date
    04-30-2011
    Location
    Kanpur, India
    MS-Off Ver
    Office 365
    Posts
    9,647

    Re: Increment column address while copying formula down

    Try this........

    Please Login or Register  to view this content.
    Regards
    sktneer


    Treat people the way you want to be treated. Talk to people the way you want to be talked to.
    Respect is earned NOT given.

  8. #8
    Forum Expert Tony Valko's Avatar
    Join Date
    12-31-2011
    Location
    Pittsburgh
    MS-Off Ver
    2002, 2007:2013
    Posts
    18,890

    Re: Increment column address while copying formula down

    Quote Originally Posted by needhelp93 View Post
    not working
    Thread title has been changed so I'm proceeding to help.

    Here's an example.

    Data Range
    A
    B
    C
    D
    E
    F
    G
    1
    Correct
    Incorrect
    ------
    ------
    Question1
    Question2
    Question3
    2
    2
    3
    incorrect
    incorrect
    incorrect
    3
    4
    1
    incorrect
    correct
    incorrect
    4
    2
    3
    correct
    correct
    incorrect
    5
    incorrect
    correct
    correct
    6
    correct
    correct
    correct


    This formula entered in A2 and copied down:

    =COUNTIF(INDEX(E$2:G$6,0,ROWS(A$2:A2)),"correct")

    This formula entered in B2 and copied down:

    =COUNTIF(INDEX(E$2:G$6,0,ROWS(B$2:B2)),"incorrect")

    You may have to post a small sample file so we can see your data structure.
    Last edited by Tony Valko; 04-27-2014 at 06:47 AM.

  9. #9
    Forum Expert Tony Valko's Avatar
    Join Date
    12-31-2011
    Location
    Pittsburgh
    MS-Off Ver
    2002, 2007:2013
    Posts
    18,890

    Re: Increment column address while copying formula down

    Quote Originally Posted by needhelp93 View Post
    cheers Tony Valko. Title sorted, sorry...
    No problem. Thanks!

  10. #10
    Forum Expert Tony Valko's Avatar
    Join Date
    12-31-2011
    Location
    Pittsburgh
    MS-Off Ver
    2002, 2007:2013
    Posts
    18,890

    Re: Increment column address while copying formula down

    To make it more dynamic, I would do something like this...

    Data Range
    A
    B
    C
    D
    E
    F
    G
    1
    Correct
    Incorrect
    ------
    Question1
    Question2
    Question3
    2
    Question1
    2
    3
    incorrect
    incorrect
    incorrect
    3
    Question2
    4
    1
    incorrect
    correct
    incorrect
    4
    Question3
    2
    3
    correct
    correct
    incorrect
    5
    incorrect
    correct
    correct
    6
    correct
    correct
    correct


    This formula entered in B2:

    =COUNTIF(INDEX($E$2:$G$6,0,MATCH($A2,$E$1:$G$1,0)),B$1)

    Copy across to C2 then down as needed.

  11. #11
    Registered User
    Join Date
    04-27-2014
    Location
    england
    MS-Off Ver
    Excel 2010
    Posts
    10

    Re: Increment column address while copying formula down

    =COUNTIF(OFFSET(Sheet1!E$2:E$36,0,(ROWS(C$4:C$4)-1)),"correct")

    This seems to be working, however I need it to change from E2:E36 to F2:F36 G2:G36 H2:H36, etc....if that possible.

    Is there a way to do this? (The $ forces the row/colum to stay the same, is there one to force it to change?) If that makes sense

    Thanks
    Last edited by needhelp93; 04-27-2014 at 07:36 AM.

  12. #12
    Registered User
    Join Date
    04-27-2014
    Location
    england
    MS-Off Ver
    Excel 2010
    Posts
    10

    Re: Increment column address while copying formula down

    Tony Valko, I tweaked yours a little bit...

    =COUNTIF(INDEX(sheet1!E$2:E$36,0,ROWS(C$4:C$4)),"correct")

    ... also works but again I need the E2:E36 to change to F2:F36, etc., as I drag down

  13. #13
    Registered User
    Join Date
    04-27-2014
    Location
    england
    MS-Off Ver
    Excel 2010
    Posts
    10

    Re: Increment column address while copying formula down

    Tony Valko, I tweaked yours a little bit...

    =COUNTIF(INDEX(sheet1!E$2:E$36,0,ROWS(C$4:C$4)),"correct")

    ... also works but again I need the E2:E36 to change to F2:F36, etc., as I drag down

  14. #14
    Forum Guru sktneer's Avatar
    Join Date
    04-30-2011
    Location
    Kanpur, India
    MS-Off Ver
    Office 365
    Posts
    9,647

    Re: Increment column address while copying formula down

    Quote Originally Posted by needhelp93 View Post
    This seems to be working, however I need it to change from E2:E36 to F2:F36 G2:G36 H2:H36, etc....if that possible.

    Thanks
    In your first post, you wanted to change the range reference E2:E36 to F2:F36, G2:G36, H2:H36, etc... while you copy the formula down the rows. This formula is exactly doing the same i.e. while you copy the formula down the rows, it will change the range reference as per your request.
    Isn't it doing that?

  15. #15
    Registered User
    Join Date
    04-27-2014
    Location
    england
    MS-Off Ver
    Excel 2010
    Posts
    10

    Re: Increment column address while copying formula down

    sktneer

    I've used this: =COUNTIF(OFFSET(Sheet1!$E$2:$E$36,0,(ROWS($C$4)-1)),"correct"), slightly tweaked version of yours.

    I've tried with and without the $ before the E to try and get it to change. At the minute the 2:36 is staying the same which I want, but it is also keeping the E, both with and without the $.

  16. #16
    Forum Guru sktneer's Avatar
    Join Date
    04-30-2011
    Location
    Kanpur, India
    MS-Off Ver
    Office 365
    Posts
    9,647

    Re: Increment column address while copying formula down

    The formula "=COUNTIF(OFFSET(Sheet1!$E$2:$E$36,0,(ROWS($C$4)-1)),"correct")" will refer to the same range E2:E36 whether you copy the formula down or across. Would you please tell me exactly what are you trying to do? What is your requirement in fact?

  17. #17
    Forum Expert Tony Valko's Avatar
    Join Date
    12-31-2011
    Location
    Pittsburgh
    MS-Off Ver
    2002, 2007:2013
    Posts
    18,890

    Re: Increment column address while copying formula down

    Tony Valko, I tweaked yours a little bit...

    =COUNTIF(INDEX(sheet1!E$2:E$36,0,ROWS(C$4:C$4)),"correct")

    ... also works but again I need the E2:E36 to change to F2:F36, etc., as I drag down
    The formula syntax in post #8 will do that.

    As I noted in my other reply, we may need to see sample file so we know how your data is structured.
    Last edited by Tony Valko; 04-27-2014 at 10:23 AM.

  18. #18
    Registered User
    Join Date
    04-27-2014
    Location
    england
    MS-Off Ver
    Excel 2010
    Posts
    10

    Re: Increment column address while copying formula down

    don't know how to upload a sample file

  19. #19
    Forum Expert Tony Valko's Avatar
    Join Date
    12-31-2011
    Location
    Pittsburgh
    MS-Off Ver
    2002, 2007:2013
    Posts
    18,890

    Re: Increment column address while copying formula down

    Taken from the forum rules:

    Post a WORKBOOK. Nobody wants to type data from a picture or paste text from your post into a spreadsheet as a prelude to helping. To attach a file, push the button with the paperclip (or scroll down to the Manage Attachments button), browse to the required file, and then push the Upload button.

  20. #20
    Registered User
    Join Date
    04-27-2014
    Location
    england
    MS-Off Ver
    Excel 2010
    Posts
    10

    Re: Increment column address while copying formula down

    thanks.........
    Attached Files Attached Files

  21. #21
    Forum Expert Tony Valko's Avatar
    Join Date
    12-31-2011
    Location
    Pittsburgh
    MS-Off Ver
    2002, 2007:2013
    Posts
    18,890

    Re: Increment column address while copying formula down

    Your data structure isn't conducive to easy analysis.

    I'll see what I can come up with but I'll be offline for several hours.

  22. #22
    Forum Expert Tony Valko's Avatar
    Join Date
    12-31-2011
    Location
    Pittsburgh
    MS-Off Ver
    2002, 2007:2013
    Posts
    18,890

    Re: Increment column address while copying formula down

    OK, here's your file.

    test upload for forum (1).xlsx

    I created a new restructured summary sheet and made a change on Sheet1 to fill in the section numbers.

  23. #23
    Registered User
    Join Date
    04-27-2014
    Location
    england
    MS-Off Ver
    Excel 2010
    Posts
    10

    Re: Increment column address while copying formula down

    Cheers mate, but this has unfortunately gone straight over my head. I'll do it manually, but thanks again

  24. #24
    Forum Expert Tony Valko's Avatar
    Join Date
    12-31-2011
    Location
    Pittsburgh
    MS-Off Ver
    2002, 2007:2013
    Posts
    18,890

    Re: Increment column address while copying formula down

    No problem.

    Good luck!

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. how to hide formula in formula box, view lookup result in formula box?
    By vengatvj in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 10-14-2013, 04:06 PM

Tags for this Thread

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