another formula to shorten

SQUIDD

Well-known Member
Joined
Jan 2, 2009
Messages
2,104
Office Version
  1. 2019
  2. 2016
Platform
  1. Windows
Hi guys, again

I have spent now 2 hours trying to shorten this formula, please help.

Code:
=
IF(AND(LARGE(AAX2:ABC2,ADG!$K$1)=AAX2,MAX(AAX2:ABC2)>LARGE(AAX2:ABC2,2)+ADG!$K$3,AAX2>ADG!$K$2),1,
IF(AND(LARGE(AAX2:ABC2,ADG!$K$1)=AAY2,MAX(AAX2:ABC2)>LARGE(AAX2:ABC2,2)+ADG!$K$3,AAY2>ADG!$K$2),2,
IF(AND(LARGE(AAX2:ABC2,ADG!$K$1)=AAZ2,MAX(AAX2:ABC2)>LARGE(AAX2:ABC2,2)+ADG!$K$3,AAZ2>ADG!$K$2),3,
IF(AND(LARGE(AAX2:ABC2,ADG!$K$1)=AAA2,MAX(AAX2:ABC2)>LARGE(AAX2:ABC2,2)+ADG!$K$3,ABA2>ADG!$K$2),4,
IF(AND(LARGE(AAX2:ABC2,ADG!$K$1)=ABB2,MAX(AAX2:ABC2)>LARGE(AAX2:ABC2,2)+ADG!$K$3,ABB2>ADG!$K$2),5,
IF(AND(LARGE(AAX2:ABC2,ADG!$K$1)=ABC2,MAX(AAX2:ABC2)>LARGE(AAX2:ABC2,2)+ADG!$K$3,ABC2>ADG!$K$2),6,
""))))))

last one now, thanks.

Dave
 

Excel Facts

What is the last column in Excel?
Excel columns run from A to Z, AA to AZ, AAA to XFD. The last column is XFD.
Dave

First take out that condition in the middle:

MAX(AAX2:ABC2)>LARGE(AAX2:ABC2,2)+ADG!$K$3

it's the same for all 6 cells, so you can separate it from the formula.
 
Upvote 0
Dave

Possibly :-
Rich (BB code):
=IFERROR(IF(INDEX(AAX2:ABC2,MATCH(LARGE(AAX2:ABC2,ADG!$K$1),AAX2:ABC2,0))>ADG!$K$2,MATCH(LARGE(AAX2:ABC2,ADG!$K$1),AAX2:ABC2,0)),"")

If not, you have an error in the formula btw :-
Rich (BB code):
Fourth line
IF(AND(LARGE(AAX2:ABC2,ADG!$K$1)=AAA2,MAX(AAX2:ABC2)>LARGE(AAX2:ABC2,2)+ADG!$K$3,ABA2>ADG!$K$2),4,

shouldn't it be
IF(AND(LARGE(AAX2:ABC2,ADG!$K$1)=ABA2,MAX(AAX2:ABC2)>LARGE(AAX2:ABC2,2)+ADG!$K$3,ABA2>ADG!$K$2),4,

hth
 
Last edited:
Upvote 0
Dave

The above was based on Wigi's suggestion of removing part of the formula.

This :-
Code:
=IFERROR(IF(AND(INDEX(AAX2:ABC2,MATCH(LARGE(AAX2:ABC2,ADG!$K$1),AAX2:ABC2,0))>ADG!$K$2,MAX(AAX2:ABC2)>LARGE(AAX2:ABC2,2)+ADG!$K$3),MATCH(LARGE(AAX2:ABC2,ADG!$K$1),AAX2:ABC2,0)),"")
is with it reinstated.

hth
 
Upvote 0
Hi Guys

Thanks for that, well spotted on the mistake in my formula, no wonder my results was not matching, "mine was wrong"

Mike, your last formula is exactly what I wanted. I just need to adjust it so it does not say FALSE if conditions are not met, I need "".
I am sure I can figure this out.

Cheers Guys.

Dave
 
Upvote 0
This formula exactly replaces the formula.
Code:
=IF(MAX(AAX2:ABC2)>LARGE(AAX2:ABC2,2)+ADG!$K$3,SUMPRODUCT(--(LARGE(AAX2:ABC2,ADG!$K$1)=AAX2:ABC2),--(AAX2:ABC2>ADG!$K$2),{1,2,3,4,5,6}),"")
In your original formula red highlighted is wrong, it should be ABA2 insted of AAA2

,ADG!$K$1)=AAA2,MAX(AAX2:ABC2)>LARGE(AAX2:ABC2,2)+ADG!$K$3,ABA2>ADG!$K$2),4,
 
Upvote 0
Thanks for that, yes indeed I did have a mistake in my formula.
Your Formula is in-fact much shorter. I like It.
The only strange thing is I get the occasional 0 in my results.
I always get my answer when required, but where i should not get a result, sometimes i get a blank cell and sometimes i get a 0.
Its no big problem, but i would prefer just blank, i will have a play with it.

Cheers

Dave
 
Upvote 0
Another way:

Code:
Use Ctrl+Shift+Enter to enter the formula

=IFERROR(MATCH(1,(LARGE(ADG!AAX2:ABC2,$K$1)=ADG!AAX2:ABC2)*(MAX(ADG!AAX2:ABC2)>LARGE(ADG!AAX2:ABC2,2)+$K$3)*(ADG!AAX2:ABC2>$K$2),0),"")

Markmzz
 
Upvote 0

Forum statistics

Threads
1,214,388
Messages
6,119,227
Members
448,878
Latest member
Da9l87

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