+ Reply to Thread
Results 1 to 8 of 8

Sum Product ( Count if working good, but I need help with dragging formula.

  1. #1
    Forum Contributor Brian.Aerojet's Avatar
    Join Date
    03-25-2017
    Location
    TN-USA
    MS-Off Ver
    2016 365
    Posts
    173

    Sum Product ( Count if working good, but I need help with dragging formula.

    After my last post a couple of days ago and talking with one of the experts on here, I thought I could figure this one out.

    I have a number line 0-9 in top row H1 through Q1

    Then I have a set of 3 digit numbers G6 through G65 (These numbers will continue)
    Also these numbers are pulled from date in column A and numbers from Column D

    Below the number line in row 24 you will see 1 1 3 3 0 3 1 4 2 3
    these numbers represent how many times each of the last 7, 3 digit numbers in column G appear.

    I have this formula in place for that row =SUMPRODUCT(COUNTIF(H$1,MID($G6:$G24,{1,2,3},1)))

    The problem is where column G does not go row after row every time, but sometimes it does for 1 row, it will not calculate the rest of the rows for me.

    You can see an example in row 25 under Columns H1 through Q1, it tries to look at G7 for next number instead of G9 through G25

    Thanks for the help,
    Brian
    Attached Files Attached Files
    Brian

  2. #2
    Forum Expert
    Join Date
    11-27-2007
    Location
    New Jersey, USA
    MS-Off Ver
    2013
    Posts
    1,669

    Re: Sum Product ( Count if working good, but I need help with dragging formula.

    See attached file. I used helper column R. Formulas in H24 to Q24 use reference to column R.
    Drag these formulas down and it works.
    Attached Files Attached Files
    1. Click on the * Add Reputation if you think this helped you
    2. Mark your thread as SOLVED when question is resolved

    Modytrane

  3. #3
    Forum Expert
    Join Date
    02-11-2014
    Location
    New York
    MS-Off Ver
    Excel 365 (Windows)
    Posts
    6,274

    Re: Sum Product ( Count if working good, but I need help with dragging formula.

    Create a list of your numbers without variable gaps - see attached.
    Attached Files Attached Files
    Bernie Deitrick
    Excel MVP 2000-2010

  4. #4
    Forum Contributor Brian.Aerojet's Avatar
    Join Date
    03-25-2017
    Location
    TN-USA
    MS-Off Ver
    2016 365
    Posts
    173

    Re: Sum Product ( Count if working good, but I need help with dragging formula.

    Sorry, I should have explained a little better.
    Where the formula goes wrong is when I drag down
    I understand both of your suggestions will work, but the problem is
    I need to keep the layout the same when I drag it to copy.

    I'm fine with the helper column, when I was trying to figure it out I also
    Had a helper column

    I Thought I could upload an updated sheet, but I'm on my phone and it won't let me.
    If you take and drag the row all the way down that is in red font from my original spreadsheet you will see where the problem is happening. After dragging down, go back
    And click on one of the red numbers in the H-Q columns.
    You will see that it isn't pulling data from the correct place.


    Thanks,
    I hope this helps
    Sorry for the confusion

  5. #5
    Forum Expert
    Join Date
    11-27-2007
    Location
    New Jersey, USA
    MS-Off Ver
    2013
    Posts
    1,669

    Re: Sum Product ( Count if working good, but I need help with dragging formula.

    I don't understand the issue. If you look at the file I attached in msg#2, format up to column Q is same as your original file. If you hide column R, everything looks the same and data in columns H thru Q is correct. Problem with column G data is that the gaps are varying. So column R puts data in consecutive rows and that makes the formulas in H:Q work better. In your last message you talk about dragging formulas in your original message but those formulas refer to column G. So that's why they don't work.

  6. #6
    Forum Expert
    Join Date
    05-05-2015
    Location
    UK
    MS-Off Ver
    Microsoft Excel for Microsoft 365 MSO (Version 2402 Build 16.0.17328.20068) 64-bit
    Posts
    30,767

    Re: Sum Product ( Count if working good, but I need help with dragging formula.

    Try this

    in F6

    =IF(G6<>"",MAX($F$5:F5)+1,"")

    copy down

    in h24

    =IF(G24<>"",SUMPRODUCT(COUNTIF(H$1,MID(INDEX($G$6:$G24,MATCH($F24-6,$F$6:$F24,0)):INDEX($G$6:$G24,MATCH($F24,$F$6:$F24,0)),{1,2,3},1))),"")

    Copy across and down
    Attached Files Attached Files

  7. #7
    Forum Contributor Brian.Aerojet's Avatar
    Join Date
    03-25-2017
    Location
    TN-USA
    MS-Off Ver
    2016 365
    Posts
    173

    Re: Sum Product ( Count if working good, but I need help with dragging formula.

    Modytrane,

    Your formula did work. I would've used it, but i knew it was possible for the way I wanted (Not consecutive)

    Im not sure about the formulas working better if the rows are consecutive. I'm still very new to excel formulas. Im trying to learn everything I can.

    One of the great things about excel is, a person can have almost any layout they want regardless of looks and make the formulas work, which is what I'm trying to do.

    Again, I do greatly appreciate you giving me something better than what i had, because mine did not work at all.

    Thanks,
    Brian

  8. #8
    Forum Contributor Brian.Aerojet's Avatar
    Join Date
    03-25-2017
    Location
    TN-USA
    MS-Off Ver
    2016 365
    Posts
    173

    Re: Sum Product ( Count if working good, but I need help with dragging formula.

    John,

    Your formulas worked exactly as I needed it.

    Thanks for taking the time to help with my issue.

+ 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. Vlookup Formula Look Good But Not WORKING!!
    By Jhon Mustofa in forum Excel Formulas & Functions
    Replies: 6
    Last Post: 12-05-2017, 10:27 AM
  2. Dragging a formula that increases in count, but doesn't skip
    By tmillo in forum Excel Formulas & Functions
    Replies: 4
    Last Post: 07-20-2016, 09:35 AM
  3. [SOLVED] dragging down formula with vlookup and iferror not working
    By Bananas212 in forum Excel Formulas & Functions
    Replies: 4
    Last Post: 03-26-2014, 05:58 PM
  4. Replies: 3
    Last Post: 03-28-2013, 12:41 PM
  5. Dragging vlookup formula not working
    By gelandl in forum Excel General
    Replies: 6
    Last Post: 03-16-2010, 04:16 AM
  6. Count Formula-Would this be a good example to use the count function?
    By JK1234 in forum Excel Formulas & Functions
    Replies: 9
    Last Post: 08-01-2008, 02:44 PM
  7. formula for product not working
    By steve in forum Excel Formulas & Functions
    Replies: 4
    Last Post: 08-04-2006, 03:55 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