Max/Frequency Question

BobA

Board Regular
Joined
Nov 16, 2008
Messages
63
Office Version
  1. 2010
Platform
  1. Windows
I have the following array formula in a spreadsheet:

={((MAX(FREQUENCY(IF(Q894:Q7001>0,ROW(Q894:Q7001)),IF(Q894:Q7001<0,ROW(Q894:Q7001))))))}

It is used to determine the largest number of positive values in a column, (longest winning streak)
and it works fine. This column contains integers that I input, no formulas are used.

However, if I use the same formula in a different column, which is derived from formulas it doesn't work.

Can this formula be amended to solve the problem, or is an entirely different approach required?

Thanks,

Bob
 
You had the right idea, but you need to reverse the arrays rather than just the symbols.
Excel Formula:
=MAX(FREQUENCY(IF(M8:M15<0,K8:K15),IF(ISNUMBER(M8:M15),IF(M8:M15>0,K8:K15))))
Got it, thanks again. I really appreciate it.
 
Upvote 0

Excel Facts

Which lookup functions find a value equal or greater than the lookup value?
MATCH uses -1 to find larger value (lookup table must be sorted ZA). XLOOKUP uses 1 to find values greater and does not need to be sorted.
One more question: How would you alter the formula to show the current winning (or losing) streak. I've been trying to figure it out for several days, and I came up with two formulas that work in a column that isn't derived from formulas, but I can't come up with a solution for what I have.
 
Upvote 0
Not sure if this will work without setting up a test sheet.
Excel Formula:
=LOOKUP(2,1/(1/FREQUENCY(IF(ISNUMBER(M8:M15),IF(M8:M15>0,K8:K15)),IF(M8:M15<0,K8:K15))))
 
Upvote 0
Not sure if this will work without setting up a test sheet.
Excel Formula:
=LOOKUP(2,1/(1/FREQUENCY(IF(ISNUMBER(M8:M15),IF(M8:M15>0,K8:K15)),IF(M8:M15<0,K8:K15))))
Sorry, but I couldn't quite get this one to work.
 
Upvote 0
What happened, or didn't happen?
Wrong result? No result? Formula not accepted by excel?
 
Upvote 0
That likely means that it needs to grab the second last element of the frequency array rather than the last one.

Are you using excel 2000 as you mentioned in an earlier post, or excel 2010 as you have added to your account details? I'm not going to look at this in detail until the morning, but I suspect that attempting this with the limitations of excel 2000 might be difficult.
 
Upvote 0
That likely means that it needs to grab the second last element of the frequency array rather than the last one.

Are you using excel 2000 as you mentioned in an earlier post, or excel 2010 as you have added to your account details? I'm not going to look at this in detail until the morning, but I suspect that attempting this with the limitations of excel 2000 might be difficult.
I was using 2000 on another computer, but I have 2010 on the one I'm using now.
 
Upvote 0
I've just done a quick test and I think that I have found the problem, although further testing may prove different. The earlier formula would have either returned a #N/A error, or a count no greater than 2.
Excel Formula:
=LOOKUP(1e+100,1/(1/FREQUENCY(IF(ISNUMBER(M8:M15),IF(M8:M15>0,K8:K15)),IF(M8:M15<0,K8:K15))))
I had used a common method for finding the last entry in an array, but had forgotten to allow for variations between this and the way it is normally used.
 
Upvote 0
I was using 2000 on another computer, but I have 2010 on the one I'm using now.

I've just done a quick test and I think that I have found the problem, although further testing may prove different. The earlier formula would have either returned a #N/A error, or a count no greater than 2.
Excel Formula:
=LOOKUP(1e+100,1/(1/FREQUENCY(IF(ISNUMBER(M8:M15),IF(M8:M15>0,K8:K15)),IF(M8:M15<0,K8:K15))))
I had used a common method for finding the last entry in an array, but had forgotten to allow for variations between this and the way it is normally used.
You are correct in that the first formula never returned a value greater than 2. However, I think the second formula nails it. I've tested it several times, and it works perfectly so far.

I spent all day on this trying several different things, but the fact is I never would have figured it out. Thanks again, much appreciated.

On a related note, I used to have a formula that does what you did above, only it showed the current streak whether it be positive or negative, all in one formula. I lost it when I transferred some things.

I seem to remember it being a max/frequency type of thing, but I don't recall exactly.

Any ideas? If it's too much work forget about it. You've been very generous with your time as it is.
 
Upvote 0

Forum statistics

Threads
1,214,872
Messages
6,122,025
Members
449,060
Latest member
LinusJE

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top