+ Reply to Thread
Results 1 to 16 of 16

Counting specific values from maximum values of specified columns

  1. #1
    Registered User
    Join Date
    03-10-2013
    Location
    Hull, England
    MS-Off Ver
    Excel 2007
    Posts
    7

    Counting specific values from maximum values of specified columns

    I have seventeen columns of data. What I need is a way to compare two to four columns at a time and count the number of times a particular number appears as a maximum.

    Please Login or Register  to view this content.
    For example my data is on the left. I need to find the number of times the number 3 is a maximum from columns B,D and E
    That should return a value of 1
    3 from D,E,F should return 3
    I have to be able to specify which columns to look at, and ideally I need to do it within a single cell.

    If it helps there are 7 possible values for each cell (8,4,2,1,1/2,1/4,1/8,0) I need to find how many times each number appears as a maximum for every possible combination of columns (up to 4 columns, 3213 combinations in total)

    I don't have the faintest idea where to start on this so any help would be greatly appreciated

  2. #2
    Forum Expert
    Join Date
    09-01-2012
    Location
    Norway
    MS-Off Ver
    Office 365
    Posts
    2,844

    Re: Counting specific values from maximum values of specified columns

    Like this? Two alternative solutions here.
    Attached Files Attached Files
    <----- If you were helped by my posts you can say "Thank you" by clicking the star symbol down to the left

    If the problem is solved, finish of the thread by clicking SOLVED under Thread Tools
    I don't wish to leave you with no answer, yet I sometimes miss posts. If you feel I forgot you, remind me with a PM or just bump the thread.

  3. #3
    Registered User
    Join Date
    03-10-2013
    Location
    Hull, England
    MS-Off Ver
    Excel 2007
    Posts
    7

    Re: Counting specific values from maximum values of specified columns

    Sorry that's not what I need. What you did is found the maximum of each column then looked for a specific value. What I need is to select the columns and find out how many times a particular number appears within that selection but I only need to consider the highest number of each row within my selection.

    Effectively I need to choose my columns then a new column needs to be created by taking the maximum value of each row (ignoring values from unselected columns) and then count how many times a number appears in the new column. The problem is that making a new column for each combination is a little impractical because of the amount of data I have.

  4. #4
    Forum Expert
    Join Date
    09-01-2012
    Location
    Norway
    MS-Off Ver
    Office 365
    Posts
    2,844

    Re: Counting specific values from maximum values of specified columns

    As usually I read every other word or line or so.
    Generating all the combinations will require some VBA code. If no one else steps in I can have a look at it tomorrow.

  5. #5
    Registered User
    Join Date
    03-10-2013
    Location
    Hull, England
    MS-Off Ver
    Excel 2007
    Posts
    7

    Re: Counting specific values from maximum values of specified columns

    If by that you mean to determine which columns need to be used for each combination I've already done that.

  6. #6
    Forum Expert
    Join Date
    09-01-2012
    Location
    Norway
    MS-Off Ver
    Office 365
    Posts
    2,844

    Re: Counting specific values from maximum values of specified columns

    Let's try with this then. I think it works but the formula is very bulky. Some other array formula guru here could probably make it more compact.
    Attached Files Attached Files

  7. #7
    Registered User
    Join Date
    03-10-2013
    Location
    Hull, England
    MS-Off Ver
    Excel 2007
    Posts
    7

    Re: Counting specific values from maximum values of specified columns

    Sorry but that just doesn't seem to work. One of the problems is that it is adding all lower values together so if I search for 3 it tells me how many have a maximum or 3 or less, I need it to tell me how many have a maximum value of exactly 3. Also two things:
    -if I so much as touch the formula (without changing anything) it stops working
    -what are the ROW functions for?

  8. #8
    Forum Expert
    Join Date
    09-01-2012
    Location
    Norway
    MS-Off Ver
    Office 365
    Posts
    2,844

    Re: Counting specific values from maximum values of specified columns

    Sorry for late reply, lost this thread.

    It's an array formula, it has to be entered with Ctrl+Shift+Delete. If you edit it ("touch it") without finishing with Ctrl+Shift+Delete then it doesn't work as an array formula anymore and it stops working. Array formulas can take arrays as arguments where normal formulas take single cells.
    The ROW function is to get an array of numbers 1, 2, 3, 4 etc. or in this case an array of ones as I divide them. It's just easier than typing in an array of ones manually.

    Unfortunately I haven't been able to solve the formula properly to get the results that you want. Anyone else?

  9. #9
    Forum Expert dredwolf's Avatar
    Join Date
    10-27-2012
    Location
    Clearwater,Canada
    MS-Off Ver
    Excel 2007
    Posts
    2,649

    Re: Counting specific values from maximum values of specified columns

    See if any 1 of these 3 possible solutions can work for you (Columns T,U or V, Rows 3 - 10; in the attachment)
    I've highlighted the ranges being used and formulas so you can compare whats happening in the formula, with what is on the sheet
    The Red highlighted cell (A34) just shows the formula I used to populate the table (info only, I copied the results, then pasted> special> values after I got a few different maxes in row 2)

    Hope this helps
    Attached Files Attached Files
    A picture may be worth a thousand words, BUT, a sample Workbook is worth a thousand screenshots!
    -Add a File - click advanced (next to quick post), scroll to manage attachments, click, select add files, click select files, select file, click upload, when file shows up at bottom left, click done (bottom right), click submit
    -To mark thread Solved- go top of thread,click Thread Tools,click Mark as Solved
    If you received helpful response, please remember to hit the * of that post

  10. #10
    Forum Expert dredwolf's Avatar
    Join Date
    10-27-2012
    Location
    Clearwater,Canada
    MS-Off Ver
    Excel 2007
    Posts
    2,649

    Re: Counting specific values from maximum values of specified columns

    After further testing, Ignore the column U solution, it has some problems with differentiating "Pump 1" from "Pump 10"(or 11,12,13,14,15,16,17 for that matter(and I would assume 18or 19 if they existed))

  11. #11
    Registered User
    Join Date
    03-10-2013
    Location
    Hull, England
    MS-Off Ver
    Excel 2007
    Posts
    7

    Re: Counting specific values from maximum values of specified columns

    Hi, Sorry for late response but I sort of forgot about this after finding a usable albeit unwieldy method. However I am still interested to see if anyone can come up with a more practical method as the 'solution' I found makes my spreadsheet almost 18MB. None of the solutions posted thus far seem to work.
    If it helps the 'solution' I found was like this:
    Please Login or Register  to view this content.
    Where ABCD and ABCE continued on for every possible combination (all 3213 of them)
    X was a variation of
    Please Login or Register  to view this content.
    Y was a variation of
    Please Login or Register  to view this content.
    Where the 0 value was replaced with 0.125,0.25,0.5,1,2,4 or 8 as needed
    The Y formulas and list of combinations were then transposed into another sheet to allow me to sort through them more easily the result was like this (The second half shows what the Y values for this sample should be)
    Please Login or Register  to view this content.
    If the formula ranges seem off it's because the range I needed to use (Shown here as Columns A-F) are F-V on my spreadsheet and my data continues down so that formulas Y appear on rows 768-775

    As I said it does give the information I need from it (and also has the added advantage of allowing me to determine which combination has the highest value from formula Y for a given number (i.e. does ABCD, ABCE, ABCF... produce more maximum values of 8)) but at 18MB it is unwieldy to say the least.
    Last edited by Arkotan; 05-05-2013 at 08:52 AM.

  12. #12
    Forum Expert dredwolf's Avatar
    Join Date
    10-27-2012
    Location
    Clearwater,Canada
    MS-Off Ver
    Excel 2007
    Posts
    2,649

    Re: Counting specific values from maximum values of specified columns

    Well...of the offered solutions, what is not working for them?
    If we don't know whats wrong with the offered solution, how can we fix it?

  13. #13
    Registered User
    Join Date
    03-10-2013
    Location
    Hull, England
    MS-Off Ver
    Excel 2007
    Posts
    7

    Re: Counting specific values from maximum values of specified columns

    Well the solution you put up is looking at each column individually finding what the maximum of each is then counting and adding when looked at. I don't want that I want a row by row maximum of the columns selected. If it helps the total of the Y values for any combination should be exactly equal to the number of rows of data I have. I'll update my post above to show what the Y values on the transposed table should be. And the other solutions I'm not sure why they aren't working just that they're returning the wrong values

  14. #14
    Forum Expert dredwolf's Avatar
    Join Date
    10-27-2012
    Location
    Clearwater,Canada
    MS-Off Ver
    Excel 2007
    Posts
    2,649

    Re: Counting specific values from maximum values of specified columns

    OK, try this one for a start point then, if it works the way you want, we can get it to be what you want in fairly short order
    Attached Files Attached Files

  15. #15
    Valued Forum Contributor Lemice's Avatar
    Join Date
    04-13-2013
    Location
    Somewhere.
    MS-Off Ver
    Excel 2016
    Posts
    696

    Re: Counting specific values from maximum values of specified columns

    Hello,

    You can try this sample file and see if this is what you are looking for.

    Here's how to use it:
    1. Place the name of the column with data you want to check on H1, I1, J1 and K1. You always have to fill in that order, from H1 to K1, but you don't need to fill all of them. If you need to check Column B, D and E for example, type "B" on H1, "D" on I1 and "E" on J1. You can put them in any order, but make sure the blank cell you leave is the last one (K1).

    2. Place the number you want to check on L1. The results will be on H2.

    In the attached file, I fill "D", "F" and "E" in H1, I1 and J1. K1 is blank. The number in L1 is 3. The result in H2 is 3.

    Note: You said you want to check from two to four column, so always fill H1 and I1. If you want the 3rd column to check, fill J1, and if you want the 4th, fill K1.
    Attached Files Attached Files
    (copy pasta from Ford)
    1. Use code tags for VBA. [code] Your Code [/code] (or use the # button)
    2. If your question is resolved, mark it SOLVED using the thread tools

    Regards,
    Lem

  16. #16
    Registered User
    Join Date
    03-10-2013
    Location
    Hull, England
    MS-Off Ver
    Excel 2007
    Posts
    7

    Re: Counting specific values from maximum values of specified columns

    Yes both of those do seem to be working

+ 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