Hi Hui,
Hope you are doing well. I haven't been able to spend much time online, but I got one of your posts (http://chandoo.org/wp/2015/03/27/conditionally-format-chart-backgrounds/), and thought I'll share one more solution.
But I don't know how to attach the file. If it's fine with you, I...
Thanks Faseeh for the feedback.
Just realized that I could take out 5 more characters :)
=SUM(OFFSET(C2,,,MATCH(0,N(--SUBSTITUTE(0&A3:A$22,".",0)>--SUBSTITUTE(A2,".",0)),)))
No takers? I understand it's relatively simple compared to a lot of the other formula challenges, but that shouldn't make you abstain!
Well, I'll go ahead and post my solution
=SUM(OFFSET(C2,,,MATCH(0,--(--SUBSTITUTE(0&A3:A$22,".","0")>--SUBSTITUTE(A2,".","0")),)))
Narayan
Of course that will work, but again, the idea is that the levels could be as long is it can... maybe 3 digits or 4 digits. Your original formula is fundamentally correct, but maybe could be a little more generic, to the extend that it considers any number of levels, and not just up to...
I might add that the only problem being, if the level exceeds to two digits, like 10, 11 or above, then the solution might not work exactly as intended
So we haven't had a new challenge in a while, so I thought I'll remind people that we have a section of the forum to pick your brains, by posting the following formula based challenge. I came across this in VBAExpress; so the credit for the question goes to the OP. So anyway, the challenge is...
Good to be back after a while, though I don't know for how long. So first thing's first.... webmax, were you able to get it to work eventually, or did you need any help.
Cheran, can you explain your requirement. What I think you want to do is to push data in to different workbooks for each...
Yes, you can add a line MsgBox sHistFile within that sub-routine somewhere to throw you a message with the content of that variable. Alternatively, you could use Debug.Print sHistFileand go to the immediate window in the vba editor by pressing CTRL+G
Deb, no reason for SUMPRODUCT. You are right, it wasn't required.
Sajan, Shaggy mentioned that he wanted to exclude 0s and Blanks. So I thought that was a quick way to cover for that.
Interesting find Narayan. Made me add an IFERROR() to my original mega formula (which by the way still falls under Lori's radar of row location, but is still effective) ;)...
Lori, yes I agree about the row location. But thanks a lot for that innovative use of FREQUENCY. That would have never occured to me!
Sajan, here's a shorter version of your formula
=LOOKUP(1,1/FREQUENCY(-9^9,-MMULT((TRANSPOSE(LOOKUP(ROW(X),ROW(X)/ISERR(-X),X))=X)*N(TRANSPOSE(X)),ROW(X)^0)),X)
Abhijeet, basically, this is what my formula is doing
=INDEX(X,INDEX({1,4,8,11},MATCH(MAX(SUMIF(OFFSET(X,{1,4,8,11},,{2,3,2,1},),"<>")),SUMIF(OFFSET(X,{1,4,8,11},,{2,3,2,1},),"<>"),)))
I'm sure you can make out what's happening in there now. :)
Just to align to your requirement, modifying Abhijeet's suggestion slightly,
=IF(B2=SUMIF($A$2:$A$25,A2,$B$2:$B$25),SUMIF($A$2:$A$25,A2,$B$2:$B$25)/SUMIF($A$2:$A$25,A2,$C$2:$C$25),"")