+ Reply to Thread
Results 1 to 6 of 6

Dragging down formulas so that it goes to the next relevant case

  1. #1
    Registered User
    Join Date
    07-12-2015
    Location
    liverpool, england
    MS-Off Ver
    Professional plus 2010
    Posts
    6

    Wink Dragging down formulas so that it goes to the next relevant case

    Hi everyone,

    I'm hoping someone on here might be able to help me. Basically, I've got a relatively simple excel formula in which I want to calculate the average of a given set of cells. So for instance, for participant_1 (below), I am using the formula =AVERAGEIF(E179:E238,"left",H179:H238) to provide me with the average duration when the stimulus is presented on the left hand side.

    Participant Side Duration(ms)
    participant_1 right 0.208
    participant_1 left 0.9
    participant_1 right 0.32
    participant_1 left 0.67

    This bit is working fine and I have devised two columns on the worksheet that look a bit like this:

    Participant Av left
    participant_1.eyd 0.48745
    participant_2.eyd ??
    participant_3.eyd ??

    What I am stuck on is how I can just drag my formula down so that it calculates the value for the next participant (participant_2.eyd), and participant_3 etc etc, all the way up to participant_94. I could just do it manually but I have 94 participants so it would be rather time consuming.
    I hope this makes sense!

    Thank you in advance for your help :-)

  2. #2
    Forum Moderator Glenn Kennedy's Avatar
    Join Date
    07-08-2012
    Location
    Digital Nomad... occasionally based in Ireland.
    MS-Off Ver
    O365 (PC) V 2403
    Posts
    44,023

    Re: Dragging down formulas so that it goes to the next relevant case

    Hi there... and welcome to the Excel Forum. Nope. I can't visualise how your data are laid out. Please attach a sample workbook. Make sure there is enough data to demonstrate your need. Make sure your desired results are shown, mock them up manually if necessary. Remember to remove ALL confidential information first!!!

    Click on GO ADVANCED and use the paperclip icon to open the upload window.

    The paperclip icon
    Glenn




    None of us get paid for helping you... we do this for fun. So DON'T FORGET to say "Thank You" to all who have freely given some of their time to help YOU.

    Temporary addition of accented to illustrate ongoing problem to the TT: L? fh?ile P?draig sona dhaoibh

  3. #3
    Forum Expert newdoverman's Avatar
    Join Date
    02-07-2013
    Location
    Port Dover, Ontario, Canada
    MS-Off Ver
    2010
    Posts
    10,330

    Re: Dragging down formulas so that it goes to the next relevant case

    This small example might help:
    With participants listed from B2:B15 and their values in C2:C15, enter this in D2 and fill down:

    =IF(COUNTIF($B$2:B2,B2)=1,AVERAGE(IF($B$2:$B$15=B2,$C$2:$C$15)),"")
    ...confirmed by pressing CTRL+SHIFT+ENTER to activate the array, not just ENTER. You will know the array is active when you see curly braces { } appear around your formula. If you do not CTRL+SHIFT+ENTER you will get an error or a clearly incorrect answer. Press F2 on that cell and try again.

    B
    C
    D
    E
    2
    Participant1
    4
    6
    =IF(COUNTIF($B$2:B2,B2)=1,AVERAGE(IF($B$2:$B$15=B2,$C$2:$C$15)),"")
    3
    Participant1
    6
    4
    Participant1
    5
    5
    Participant1
    8
    6
    Participant1
    7
    7
    Participant2
    1
    2
    8
    Participant2
    2
    9
    Participant2
    3
    10
    Participant3
    4
    4
    11
    Participant3
    5
    12
    Participant3
    6
    13
    Participant3
    4
    14
    Participant3
    3
    15
    Participant3
    2
    <---------If you like someone's answer, click the star to the left of one of their posts to give them a reputation point for that answer.
    Ron W

  4. #4
    Registered User
    Join Date
    07-12-2015
    Location
    liverpool, england
    MS-Off Ver
    Professional plus 2010
    Posts
    6

    Re: Dragging down formulas so that it goes to the next relevant case

    That's great, thank you for your response. However, I also have another column titled 'direction' and I only want to calculate the average of the values which correspond to the "left". Do you know how I can incorporate this into the formula?

    My spreadsheet looks like this:

    A B C
    Participant Side Duration
    Participant_1 Left 0.23
    Participant_1 Right 0.45


    Thanks :-)

  5. #5
    Forum Moderator Glenn Kennedy's Avatar
    Join Date
    07-08-2012
    Location
    Digital Nomad... occasionally based in Ireland.
    MS-Off Ver
    O365 (PC) V 2403
    Posts
    44,023

    Re: Dragging down formulas so that it goes to the next relevant case

    Please attach a sample workbook. Make sure there is enough data to demonstrate your need. Make sure your desired results are shown, mock them up manually if necessary. Remember to remove ALL confidential information first!!!

    Click on GO ADVANCED and use the paperclip icon to open the upload window.

    The paperclip icon

  6. #6
    Registered User
    Join Date
    07-12-2015
    Location
    liverpool, england
    MS-Off Ver
    Professional plus 2010
    Posts
    6

    Re: Dragging down formulas so that it goes to the next relevant case

    Also, this seems to work for the first participant, but when I drag down it doesn't give me any values for the next participants - it just says #VALUE!

+ 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. [SOLVED] Dragging Formulas Down
    By hftechno in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 11-13-2014, 02:01 AM
  2. Formulas to sort data and fill the relevant cells
    By Benjamin2008 in forum Excel General
    Replies: 2
    Last Post: 03-19-2011, 11:02 AM
  3. Dragging Formulas
    By grghhn in forum Excel General
    Replies: 2
    Last Post: 05-07-2010, 01:17 AM
  4. Dragging formulas
    By Thawk in forum Excel General
    Replies: 5
    Last Post: 02-11-2009, 04:29 PM
  5. Excel 2007 : Dragging Formulas Down???
    By Jordan-Circle in forum Excel General
    Replies: 2
    Last Post: 10-15-2008, 03:47 PM

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