Highlight lowest value in row, calculate each column based on lowest values, print results

xdriver

Board Regular
Joined
Mar 21, 2014
Messages
73
Office Version
  1. 365
Platform
  1. MacOS
There are more values in the sheet, so I will need to work in the selected ranges. I have pricing from different vendors (V1-x) for the same product, (Product 1-x) as there are hundreds of products. I would like to highlight the lowest value in each row in green (so I can visually see which vendor is the lowest price for that product), and the highest value in red. Then, I would like to do a calculation at the bottom of each column that only sums the items in the column if they are the lowest price.

While not necessary but it would be great, is there a way to create another sheet that "prints" a list of the product, lowest price and the vendor that sells it, so I can place an order with each vendor while getting the best prices?

Thank you so much.


V1V2V3V4
Product 15.253.55.99
Product 226.6521.69929.85
Product 332.6432.92933.75
Product 421.61922.9
Product 513.681313.9
Product 626.6521.69929.85
Product 732.6432.92933.75
Product 821.5919.16422.85
Product 921.7617.27622.5
Product 1021.61922.9
Product 1132.6432.92933.75
Product 1281.9685.57987.48
Product 1348.9637.29953.5
Product 1440.9640.9639.5
Product 1565.8868.68464.68
Product 1658.9458.00562.5
Product 1725.2326.67227.5
Product 18231.84231.84251.72
Product 19122.94122.94131.22
Product 2081.9685.57987.48
 

Excel Facts

How to show all formulas in Excel?
Press Ctrl+` to show all formulas. Press it again to toggle back to numbers. The grave accent is often under the tilde on US keyboards.
Have you tried
1. Selecting B2:E21
2. Conditional format using a formula: =B2=MIN($B2:$E21) and set it to green then =B2=MAX($B2:$E2) set to red?

Book1
ABCDE
1V1V2V3V4
2Product 15.253.55.99
3Product 226.6521.69929.85
4Product 332.6432.92933.75
5Product 421.61922.9
6Product 513.681313.9
7Product 626.6521.69929.85
8Product 732.6432.92933.75
9Product 821.5919.16422.85
10Product 921.7617.27622.5
11Product 1021.61922.9
12Product 1132.6432.92933.75
13Product 1281.9685.57987.48
14Product 1348.9637.29953.5
15Product 1440.9640.9639.5
16Product 1565.8868.68464.68
17Product 1658.9458.00562.5
18Product 1725.2326.67227.5
19Product 18231.84231.84251.72
20Product 19122.94122.94131.22
21Product 2081.9685.57987.48
Sheet14
 
Upvote 0
I suggest that you update your Account details (or click your user name at the top right of the forum) so helpers always know what Excel version(s) & platform(s) you are using as the best solution often varies by version. (Don’t forget to scroll down & ‘Save’)

How about
+Fluff 1.xlsm
ABCDE
1V1V2V3V4
2Product 15.253.55.99
3Product 226.6521.69929.85
4Product 332.6432.92933.75
5Product 421.61922.9
6Product 513.681313.9
7Product 626.6521.69929.85
8Product 732.6432.92933.75
9Product 821.5919.16422.85
10Product 921.7617.27622.5
11Product 1021.61922.9
12Product 1132.6432.92933.75
13Product 1281.9685.57987.48
14Product 1348.9637.29953.5
15Product 1440.9640.9639.5
16Product 1565.8868.68464.68
17Product 1658.9458.00562.5
18Product 1725.2326.67227.5
19Product 18231.84231.84251.72
20Product 19122.94122.94131.22
21Product 2081.9685.57987.48
Lists
Cells with Conditional Formatting
CellConditionCell FormatStop If True
B2:E21Expression=MAX($B2:$E2)=B2textNO
B2:E21Expression=MIN($B2:$E2)=B2textNO
 
Last edited:
Upvote 0
If you can accept a slightly different presentation, then I have a Power Query Solution for you.

Power Query:
let
    Source = Excel.CurrentWorkbook(){[Name="Table1"]}[Content],
    #"Changed Type" = Table.TransformColumnTypes(Source,{{"Column1", type text}, {"V1", type number}, {"V2", type number}, {"V3", type any}, {"V4", type number}}),
    #"Inserted Maximum" = Table.AddColumn(#"Changed Type", "Maximum", each List.Max({[V1], [V2], [V4]}), type number),
    #"Inserted Minimum" = Table.AddColumn(#"Inserted Maximum", "Minimum", each List.Min({[V1], [V2], [V4]}), type number)
in
    #"Inserted Minimum"

Book7
ABCDEFG
1Column1V1V2V3V4MaximumMinimum
2Product 15.253.55.995.993.5
3Product 226.6521.69929.8529.8521.699
4Product 332.6432.92933.7533.7532.64
5Product 421.61922.922.919
6Product 513.681313.913.913
7Product 626.6521.69929.8529.8521.699
8Product 732.6432.92933.7533.7532.64
9Product 821.5919.16422.8522.8519.164
10Product 921.7617.27622.522.517.276
11Product 1021.61922.922.919
12Product 1132.6432.92933.7533.7532.64
13Product 1281.9685.57987.4887.4881.96
14Product 1348.9637.29953.553.537.299
15Product 1440.9640.9639.540.9639.5
16Product 1565.8868.68464.6868.68464.68
17Product 1658.9458.00562.562.558.005
18Product 1725.2326.67227.527.525.23
19Product 18231.84231.84251.72251.72231.84
20Product 19122.94122.94131.22131.22122.94
21Product 2081.9685.57987.4887.4881.96
Table1
 
Upvote 0
I have update my profile, thank you for the recommendation.
I have done the conditional formatting highlighting with the suggested expressions but its the tally I am struggling with.
I was able to use =SUM(IF(C2:C21<B2:B21,C2:C21)) when I just had two columns, but now that I have multiple ones I am not sure what to do.
The "power query" would be a fine solution, but I still need to see a total of the lowest values and which vendor has them. And then if possible print a "pick list" of sorts to make ordering easy.
 
Upvote 0
If you use CF to provide an interior color, I believe you'll have to use VBA to identify those cells.
See if this is what you want or can be adapted for your needs.

Book1
ABCDE
1V1V2V3V4
2Product 15.253.55.99
3Product 226.6521.69929.85
4Product 332.6432.92933.75
5Product 421.61922.9
6Product 513.681313.9
7Product 626.6521.69929.85
8Product 732.6432.92933.75
9Product 821.5919.16422.85
10Product 921.7617.27622.5
11Product 1021.61922.9
12Product 1132.6432.92933.75
13Product 1281.9685.57987.48
14Product 1348.9637.29953.5
15Product 1440.9640.9639.5
16Product 1565.8868.68464.68
17Product 1658.9458.00562.5
18Product 1725.2326.67227.5
19Product 18231.84231.84251.72
20Product 19122.94122.94131.22
21Product 2081.9685.57987.48
22
23Low 641.85Low 584.422Low 0Low 104.18
24High 40.96High 109.644High 0High 973.39
Sheet14


Code:
Sub SumHighLow()
Dim slo As Double, shi As Double, i As Long, j As Long, lr As Long
lr = Cells(Rows.Count, "A").End(xlUp).Row
For j = 2 To 5
slo = 0
shi = 0
For i = 2 To lr
 If 14348258 = Cells(i, j).DisplayFormat.Interior.Color Then ' CF green
 slo = slo + Cells(i, j)
 ElseIf 1137094 = Cells(i, j).DisplayFormat.Interior.Color Then ' CF red
 shi = shi + Cells(i, j)
 Else
 End If
Next i
Cells(23, j) = "Low  " & slo
Cells(24, j) = "High " & shi
Next j
End Sub
 
Upvote 0
After running PQ and bring the file into Excel, Convert the Table to a range and apply the formulas shown. Keep in mind that this is an alternative to VBA.

Book7.xlsx
ABCDEFGHI
1Column1V1V2V3V4MaximumMinimumMax VendorMin Vendor
2Product 15.253.55.995.993.5V4V2
3Product 226.6521.69929.8529.8521.699V4V2
4Product 332.6432.92933.7533.7532.64V4V1
5Product 421.61922.922.919V4V2
6Product 513.681313.913.913V4V2
7Product 626.6521.69929.8529.8521.699V4V2
8Product 732.6432.92933.7533.7532.64V4V1
9Product 821.5919.16422.8522.8519.164V4V2
10Product 921.7617.27622.522.517.276V4V2
11Product 1021.61922.922.919V4V2
12Product 1132.6432.92933.7533.7532.64V4V1
13Product 1281.9685.57987.4887.4881.96V4V1
14Product 1348.9637.29953.553.537.299V4V2
15Product 1440.9640.9639.540.9639.5V1V4
16Product 1565.8868.68464.6868.68464.68V2V4
17Product 1658.9458.00562.562.558.005V4V2
18Product 1725.2326.67227.527.525.23V4V1
19Product 18231.84231.84251.72251.72231.84V4V1
20Product 19122.94122.94131.22131.22122.94V4V1
21Product 2081.9685.57987.4887.4881.96V4V1
221083.034975.672
Table1
Cell Formulas
RangeFormula
H2,H4:H21H2=XLOOKUP(Table1!F2,Table1!B2:E2,Table1!$B$1:$E$1)
I2:I21I2=XLOOKUP(G2,B2:E2,$B$1:$E$1)
F22F22=SUBTOTAL(109,Table1!$F$2:$F$21)
G22G22=SUBTOTAL(109,Table1!$G$2:$G$21)


@xdriver

Late Edit: My apologies as this solution will not work for you. I just noticed that you are running a MAC. Power Query is not an option for MAC users.
 
Upvote 0

Forum statistics

Threads
1,214,827
Messages
6,121,824
Members
449,050
Latest member
Bradel

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