+ Reply to Thread
Results 1 to 6 of 6

Using Count/Frequency/Binning to sort data

Hybrid View

  1. #1
    Registered User
    Join Date
    01-20-2012
    Location
    Newcastle, England
    MS-Off Ver
    Excel 2007
    Posts
    8

    Using Count/Frequency/Binning to sort data

    Hello All,

    I have a large amount of data that is in two columns and I am trying to use some kind of formula to count the number of times a measurement falls between two values in each column and then use that data to populate a table. I've attached an example which shows a very simplified version of what I'm after.

    In the example the X and the Y colums have the values and I want to populate the table on the right with how many samples with X = 1 also have Y =1 and how many have Y=2 etc. I've included my best shot so far but it isn't anywhere near what I'm after. The ultimate goal is to produce a surface plot and also analyse the count data in a statistical package (yet to be sourced).

    Any help with this either through functions or coding would be much appreciated.

    Thanks

    Jarvice
    Attached Files Attached Files

  2. #2
    Forum Expert tigeravatar's Avatar
    Join Date
    03-25-2011
    Location
    Colorado, USA
    MS-Off Ver
    Excel 2003 - 2013
    Posts
    5,361

    Re: Using Count/Frequency/Binning to sort data

    Jarvice,

    It looks to me like you're trying to make it too complicated. A CountIfs() should work for this. In cell F3 and copied over and down (not an array formula):
    =COUNTIFS(X,">="&$D3,X,"<"&$D3+1,Y,">="&F$2,Y,"<"&F$2+1)
    Last edited by tigeravatar; 03-13-2012 at 02:04 PM.
    Hope that helps,
    ~tigeravatar

    Forum Rules: How to use code tags, mark a thread solved, and keep yourself out of trouble

  3. #3
    Forum Expert
    Join Date
    03-23-2004
    Location
    London, England
    MS-Off Ver
    Excel 2019
    Posts
    7,077

    Re: Using Count/Frequency/Binning to sort data

    in E3
    =SUMPRODUCT(--(INT($A$2:$A$20)=$D3)*($B$2:$B$20=F$2))

    copy across and down
    Regards
    Special-K

    Ensure you describe your problem clearly, I have little time available to solve these problems and do not appreciate numerous changes to them.

  4. #4
    Forum Expert
    Join Date
    07-16-2010
    Location
    Northumberland, UK
    MS-Off Ver
    Excel 2007 (home), Excel 2010 (work)
    Posts
    3,054

    Re: Using Count/Frequency/Binning to sort data

    In cell F9 of your example sheet I went with:

    =SUMPRODUCT(--(X>=$D9),--(X<($D9+1)),--(Y=F$8))

    Copied across and down - seems to match your expected output.

  5. #5
    Forum Guru (RIP) Marcol's Avatar
    Join Date
    12-23-2009
    Location
    Fife, Scotland
    MS-Off Ver
    Excel '97 & 2003/7
    Posts
    7,216

    Re: Using Count/Frequency/Binning to sort data

    Try this in F3
    =SUMPRODUCT(--(X>=$D3),--(X<$D3+1),--(Y=F$2),--(Y<F$2+1))
    Drag Across to Column J, then Down.
    Last edited by Marcol; 03-13-2012 at 12:34 PM.
    If you need any more information, please feel free to ask.

    However,If this takes care of your needs, please select Thread Tools from menu above and set this topic to SOLVED. It helps everybody! ....

    Also
    اس کی مدد کرتا ہے اگر
    شکریہ کہنے کے لئے سٹار کلک کریں
    If you are satisfied by any members response to your problem please consider using the small Star icon bottom left of their post to show your appreciation.

  6. #6
    Registered User
    Join Date
    01-20-2012
    Location
    Newcastle, England
    MS-Off Ver
    Excel 2007
    Posts
    8

    Re: Using Count/Frequency/Binning to sort data

    Hello All,

    Thanks for the advice all. I went with Marcol's fix with a slight modification (substituted D$4 for D$3+1) to account for the fact that my X bins are different sizes. Works a treat and I can now plot the data as a 3D surface plot and replace an ancient MS-DOS programme that did the same thing! Now I just need to work out some statistics!

    Thanks again

    Gavin

+ 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