Select a maximum value from a column which has repeated values

rac241985

New Member
Joined
Jan 30, 2017
Messages
27
PhoneCountryCount IfLaunch
IphoneSingapore1Apr 2017
IphoneSingapore2Apr 2018
IphoneVietnam1Mar 2019
IphoneChina1Jun 2019
SamsungSingapore1Apr 2019
SamsungChina1Aug 2017
SamsungTurkey1Jun 2017
SamsungTurkey2Jul 2018

<tbody>
</tbody>


Count if Formula used: COUNTIF($B$1:B1,B1)

I have 4 columns as shown above. In column B, the country maybe repeated twice. I tried to use the count if function as shown above. I am not sure how to extract the maximum number and show the output based on that as follows if the user selects Iphone. I know how to extract the first time the value occurs (i.e. when Output is "1"). Not sure how to extract it for the maximum number. Can someone please help


Desired Output:
PhoneCountryLaunch
IphoneSingaporeApr 2018
IphoneVietnamMar 2019
IphoneChinaJun 2019

<tbody>
</tbody>
 

Aladin Akyurek

MrExcel MVP
Joined
Feb 14, 2002
Messages
85,138
PhoneCountryCount IfLaunchIphone
IphoneSingapore1Apr-173
IphoneSingapore2Apr-18countrylaunch
IphoneVietnam1Mar-19SingaporeApr-18
IphoneChina1Jun-19VietnamMar-19
SamsungSingapore1Apr-19ChinaJun-19
SamsungChina1Aug-17
SamsungTurkey1Jun-17
SamsungTurkey2Jul-18

<tbody>
</tbody>

In F2 control+shift+enter, not just enter:

=SUM(IF(FREQUENCY(IF(1-($B$2:$B$9=""),IF($A$2:$A$9=F$1,MATCH($B$2:$B$9,$B$2:$B$9,0))),ROW($B$2:$B$9)-ROW($B$2)+1),1))

In F4 control+shift+enter, not just enter, and copy down:

=IF(ROWS($F$4:F4)>$F$2,"",INDEX($B$2:$B$9,SMALL(IF(FREQUENCY(IF(1-($B$2:$B$9=""),IF($A$2:$A$9=F$1,MATCH($B$2:$B$9,$B$2:$B$9,0))),ROW($B$2:$B$9)-ROW($B$2)+1),ROW($B$2:$B$9)-ROW($B$2)+1),ROWS($F$4:F4))))

In G4 control+shift+enter, not just enter, and copy down:

=IF($F4="","",MAX(IF($A$2:$A$9=$F$1,IF($B$2:$B$9=$F4,$D$2:$D$9))))

If you have MAXIFS available on your system, you can invoke in G4 which needs just enter...

=IF($F4="","",MAXIFS($D$2:$D$9,$A$2:$A$9,$F$1,$B$2:$B$9,$F4))

and copy down.
 

Forum statistics

Threads
1,081,517
Messages
5,359,234
Members
400,523
Latest member
ExcelNewbie98

Some videos you may like

This Week's Hot Topics

  • VBA (Userform)
    Hi All, I just would like to know why my code isn't working. Here is my VBA code: [CODE=vba]Private Sub OKButton_Click() Dim i As Integer...
  • List box that changes fill color
    Hello, I have gone through so many pages trying to figure this out. I have a 2020 calendar that depending on the day needs to have a certain...
  • Remove duplicates and retain one. Cross-linked cases
    Hi all I ran out of google keywords to use and still couldn't find a reference how to achieve the results of a single count. It would be great if...
  • VBA Copy and Paste With Duplicates
    Hello All, I'm in need of some input. My VBA skills are sub-par at best. I've assembled this code from basic research and it works but is...
  • Macro
    is it possible for a macro to run if the active cell value is different to the value above it
  • IF DATE and TIME
    I currently use this to check if date has passed but i also need to set a time on it too. Is it possible? [CODE=vba]=IF(B:B>TODAY(),"Not...
Top