Can i combine these 2 formulas into 1? MAX IF

JumboCactuar

Well-known Member
Joined
Nov 16, 2016
Messages
785
Office Version
  1. 365
Platform
  1. Windows
Hi,

i have the 2 formulas which work

G2
Code:
{=MAX(IF($A$2:$A$20000=A2,$G$2:$G$20000,0))}
gets max value of column A data

H2
Code:
=IF(G2=O2,1,0)
checks to see if value in G2 is highest, if so output 1

Im sure i can merge these somehow

thanks in advance
 
Last edited:

Excel Facts

Show numbers in thousands?
Use a custom number format of #,##0,K. Each comma after the final 0 will divide the displayed number by another thousand
sorry guys, where i post G2/H2 that isnt right. its H2 and I2

this is example data:

ABCDEFGHI
red000002162540
red000002542541
blue000005715711
blue000002545710
blue00000445710
yellow0000033331
green000004805140
green00000485140
green000005145141
black00000811340
black00000371340
black000001341341
white000002362361
white00000392360

<tbody>
</tbody>

H + I are my helper columns

H2:
Code:
=MAX(IF($A$2:$A$20000=A2,$G$2:$G$20000,0))

I2:
Code:
=IF(G2=H2,1,0)

i can autofill them down to last row
just wondering if i can do this all in 1 column instead of 2

thanks
 
Last edited:
Upvote 0
One of:

1. Control+shift+enter, not just enter, and copy down:

=($G2=
MAX(IF($A$2:$A$20000=$A2,$G$2:$G$20000
)))+0

2. If you have MAXIFS, just enter and copy down:

=($G2=MAXIFS($G$2:$G$20000,
$A$2:$A$20000,$A2))+0
 
Upvote 0
One of:

1. Control+shift+enter, not just enter, and copy down:

=($G2=
MAX(IF($A$2:$A$20000=$A2,$G$2:$G$20000
)))+0

2. If you have MAXIFS, just enter and copy down:

=($G2=MAXIFS($G$2:$G$20000,
$A$2:$A$20000,$A2))+0

perfect, 1st one works
2nd gives #NAME

thankyou
 
Upvote 0
is there a reason why it doesnt let me fill down this array formula with vba ?

ive tried these 2:
Rich (BB code):
        lr = Cells(Rows.Count, "L").End(xlUp).Row
   	Range("x2:x" & lr).FormulaArray = "=(RC7=MAX(IF(R2C1:R20000C1=RC1,R2C7:R20000C7)))+0"

Rich (BB code):
	lr = Cells(Rows.Count, "L").End(xlUp).Row
   	Range("x2:x" & lr).FormulaArray = "=(RC7=MAX(IF(R2C1:R20000C1=RC1,R2C7:R20000C7)))+0"
    	Range("x2:x" & lr).FillDown

it outputs the exact formula in every cell
Rich (BB code):
=($G2=MAX(IF($A$2:$A$20000=$A2,$G$2:$G$20000)))+0


 
Upvote 0

Forum statistics

Threads
1,213,506
Messages
6,114,027
Members
448,543
Latest member
MartinLarkin

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