Find minimum value for each row based on selected columns and highlight the lowest value

weijianhk

New Member
Joined
Feb 27, 2015
Messages
18
I would like to seek some help on the problem that I'm facing. I'm trying to highlight the lowest value in the sheet for each row based on selected columns, i.e. iot1, iot2, iot3. If you see the before and after image below, I would like to get some assistance on how to highlight the lowest (minimum) value. Thank you very much, any assistance is much appreciated!

Before:
c27kmd


After:
 
Last edited:

Excel Facts

Select all contiguous cells
Pressing Ctrl+* (asterisk) will select the "current region" - all contiguous cells in all directions.
I would like to seek some help on the problem that I'm facing. I'm trying to highlight the lowest value in the sheet for each row based on selected columns, i.e. iot1, iot2, iot3. If you see the before and after image below, I would like to get some assistance on how to highlight the lowest (minimum) value. Thank you very much, any assistance is much appreciated!

Before:


After:

You cannot post images that reside on your local hard drives.
 
Upvote 0
You cannot post images that reside on your local hard drives.

Hi Rick,
Noted with thanks, sorry about it.

Have updated my post here.
I would like to seek some help on the problem that I'm facing. I'm trying to highlight the lowest value in the sheet for each row based on selected columns, i.e. iot1, iot2, iot3. If you see the before and after image below, I would like to get some assistance on how to highlight the lowest (minimum) value. Thank you very much, any assistance is much appreciated!


Before
https://ibb.co/c27kmd


After
https://ibb.co/ego2XJ
 
Upvote 0
Without the benefit of being able to see your pictures, I guessed at the following possible macro solution for you to try...
Code:
Sub HighlightLowNumbersPerRowForSelectedColumns()
  Dim R As Long, LastRow As Long, Min As Double, Cell As Range
  LastRow = Cells(Rows.Count, "A").End(xlUp).Row
  For R = 1 To LastRow
    Min = Application.Min(Intersect(Selection, Rows(R)))
    For Each Cell In Intersect(Selection, Rows(R))
      If Cell.Value = Min Then Cell.Interior.Color = vbYellow
    Next
  Next
End Sub
 
Upvote 0
Without the benefit of being able to see your pictures, I guessed at the following possible macro solution for you to try...
Code:
Sub HighlightLowNumbersPerRowForSelectedColumns()
  Dim R As Long, LastRow As Long, Min As Double, Cell As Range
  LastRow = Cells(Rows.Count, "A").End(xlUp).Row
  For R = 1 To LastRow
    Min = Application.Min(Intersect(Selection, Rows(R)))
    For Each Cell In Intersect(Selection, Rows(R))
      If Cell.Value = Min Then Cell.Interior.Color = vbYellow
    Next
  Next
End Sub

Hi Rick,
Many thanks! I have inserted your code and it works like a charm but it also highlights when the cells are null. Possible to prevent the cell highlight for null values?
Thanks again!
 
Upvote 0
Hi Rick,
Many thanks! I have inserted your code and it works like a charm but it also highlights when the cells are null. Possible to prevent the cell highlight for null values?
It does not do that for me... blank cells remain unhighlighted. I am using XL2010 if that might make a difference (although I don't think it should).
 
Upvote 0
It does not do that for me... blank cells remain unhighlighted. I am using XL2010 if that might make a difference (although I don't think it should).

No worries, I just managed to fix it by including "If Not IsEmpty(Cell.Value)"
I'm all good now!

Thanks once again master!!!
 
Upvote 0

Forum statistics

Threads
1,224,823
Messages
6,181,182
Members
453,021
Latest member
Mohamed Magdi Tawfiq Emam

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