Conditional Formatting - Nearest to Zero

alexfooty

Board Regular
Joined
Dec 30, 2018
Messages
97
Office Version
  1. 2016
Platform
  1. Windows
In the cells below (AN25:BL25) I want to use conditional formatting to highlight the cell whose value is nearest to cell AM25 (Zero)

I have tried the formula =ABS(AN25-$AM$25)=MIN(ABS($AN$25:$BL$25-$AM$25)) which doesn't seem to work.

Also note that between each of the cells there are two hidden columns which do NOT contain any data or formulas.

Any help would be greatly appreciated.


Image 3.png
 
Using the same basic method as Peter's suggestion which you are already using for the conditional formatting, try entering this one in AN26 and dragging right.

Must be array confirmed with Crtl Shift Enter.

=SUM(IFERROR(--(ABS(AN25-$AM25)>=(ABS($AN25:$BL25-$AM25)/($AN25:$BL25<>""))),""))

Results might not be as expected with duplicate values in row 25.
 
Upvote 0

Excel Facts

Excel Can Read to You
Customize Quick Access Toolbar. From All Commands, add Speak Cells or Speak Cells on Enter to QAT. Select cells. Press Speak Cells.
Results might not be as expected with duplicate values in row 25.
.. duplicate absolute values too as shown in row 26..

An alternative in row 27 that allows for ties. I'm assuming always zero in column AM.

20 08 31.xlsm
AMANAQATAWAZBCBFBIBL
250-27-3-17-2737-2724-39
26824823859
27614613659
CF near value (2)
Cell Formulas
RangeFormula
AN26,AQ26,AT26,AW26,AZ26,BC26,BF26,BI26,BL26AN26=SUM(IFERROR(--(ABS(AN25-$AM25)>=(ABS($AN25:$BL25-$AM25)/($AN25:$BL25<>""))),""))
AN27,AQ27,AT27,AW27,AZ27,BC27,BF27,BI27,BL27AN27=SUMPRODUCT(--(ABS($AN25:$BL25)<ABS(AN25)),--($AN25:$BL25<>""))+1
Cells with Conditional Formatting
CellConditionCell FormatStop If True
AN25:BL25Expression=ABS(AN25)=AGGREGATE(15,6,ABS($AN25:$BL25)/($AN25:$BL25<>""),1)textNO
 
Upvote 0
You are correct. I made 2 values the same and they were both ranked as 2 instead of 1. Changed the formula and all is well. Many thanks to both of you for your imput.
 
Upvote 0

Forum statistics

Threads
1,214,920
Messages
6,122,279
Members
449,075
Latest member
staticfluids

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