Multi column conditional formatting

Ricki

New Member
Joined
Sep 5, 2014
Messages
28
Office Version
  1. 365
Platform
  1. Windows
I don't know if this is possible but here goes.

I have a speadsheet which I need to find the top 5 items based on item in column A (Lower # More important) and a value B (Higher # more important) and highlight them.

for example:
COLUMN A COLUMN B
1 5
2 4
3 7
2 6
1 7
In this example say I want the top item most important based on column A (which would be 1) and 7 in column B.

Is there a way to do this? I would like the value in Column B to be highlighted.
 

Excel Facts

Create a Pivot Table on a Map
If your data has zip codes, postal codes, or city names, select the data and use Insert, 3D Map. (Found to right of chart icons).
Paste the following into a regular module :

VBA Code:
Sub LargestInRange_array()
  Dim sh As Worksheet, arr, nrR As Long, i As Long
 
  Set sh = ActiveSheet             'use here the sheet you need
  arr = sh.Range("B2:B15").Value 'put the range in an array
 
  nrR = 1 'the number of Top to be returned (that 10 to 30, in your question)

  'clear the previous returned Top:
  'sh.Range("B2:B" & sh.Range("B" & sh.Rows.Count).End(xlUp).Row).ClearContents
  For i = 1 To nrR
    sh.Range("C" & i + 1).Value = WorksheetFunction.Large(arr, i)
  Next i
 
  arr = sh.Range("A2:A15").Value
  For i = 1 To nrR
    sh.Range("D" & i + 1).Value = WorksheetFunction.Small(arr, i)
  Next i
End Sub

The results should be displayed in C2 and D2
 

Attachments

  • Large Small.jpg
    Large Small.jpg
    29.4 KB · Views: 6
Upvote 0
Try. Select B2:B6.
Formula for CF.
Excel Formula:
=AND($A2=MIN($A$2:$A$6),$B2=AGGREGATE(14,6,$B$2:$B$6/($A$2:$A$6=MIN($A$2:$A$6)),1))
 
Last edited:
Upvote 0
Try. If Only B column is to be CF ,select B2:B6. IF Full range is to be CF then select A2:B6
Formula for CF.
Excel Formula:
=AND($A2=MIN($A$2:$A$6),$B2=AGGREGATE(14,6,$B$2:$B$6/($A$2:$A$6=MIN($A$2:$A$6)),1))
 
Upvote 0

Forum statistics

Threads
1,224,823
Messages
6,181,170
Members
453,021
Latest member
Justyna P

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