Smallest difference between columns B and C, returning the position of column A, ommiting #N/A and blanks

Frankroger

New Member
Joined
Nov 16, 2023
Messages
15
Office Version
  1. 2013
Platform
  1. Windows
I'm trying to get the position of column A, by finding the absolute minimum difference between column ranges C and D

Formula in cell H3, works, but then breaks down when error cells are included in the ranges

In this example, the smallest absolute difference between ranges C1:C6 and D1:D6 was cells C3 and D3, as the difference between these two cells was the smallest.
The formula then returned to me cell A3, value 3, which is correct.

But if we include #N/A cells in the ranges, it fails.

The formula in H1, omits the errors, and returns to me the smallest absolute difference between columns C and D, but I can't get it to return the position from column A

So either I need to be able to add an index match function to the formula in H1, to return the position from column A

Or I need to be able to add the ignore errors function into the formula in H3

I've been unable to solve



help.xlsx
ABCDEFGHIJKLMNOPQRSTUVWXYZAAABACADAEAFAG
111020102The formula omits #N/A error cells and finds the smallest absolute difference between columns C and D, which was 2, but I need it to return the position from cell A3
22102010
33792
441020103This formula does what I'm trying to do! , It find the smallest difference between colums C and D and returns the position from Column A, but it doesn't omit #N/A cells!
55102010
66102010
7
8
9
101102010#N/A#N/A values in ranges breaks the formula
112102010
123792
134102010
145#N/A20#N/A
156102010
Sheet1
Cell Formulas
RangeFormula
H1H1=MIN(IFERROR(IF(ISERROR(ABS(C1:C6-D1:D6)),"",ABS(C1:C6-D1:D6)),ABS(C1:C6-D1:D6)))
H4H4=INDEX(A1:A6,MATCH(MIN(ABS(C1:C6-D1:D6)),ABS(C1:C6-D1:D6),0))
F10:F15,F1:F6F1=ABS(D1-C1)
H10H10=INDEX(A10:A15,MATCH(MIN(ABS(C10:C15-D10:D15)),ABS(C10:C15-D10:D15),0))
Press CTRL+SHIFT+ENTER to enter array formulas.
 

Excel Facts

What is the last column in Excel?
Excel columns run from A to Z, AA to AZ, AAA to XFD. The last column is XFD.
Xl 2013 does not have Xlookup or Filter. ;)
 
Upvote 0
Ahh I've figured how to add the index match to my formula in H1 now so all is good

Thank you for your time in helping me sir, may the gods be with you! 🙏
 
Upvote 0
Could you quote the formula in cell H10 from this post Sunny, along with the formula you originally gave me

I can then mark it as solved in case anyone else at some point has a similar problem to this and is searching around.

You took the time to help me,
so I want to credit you with the solution Sir.
thanks for your time! 🙂


copy this formula to cell " H1 "



its helping u to know ABS from "C1:C6-D1:D6", although have #N/A condition and the formula will showing Column A based on ABS"C1:C6-D1:D6"

*
*If there’s any unclear information please let me know :)

Solution -

Book2
ABCDEFGHIJKLMNOPQRST
104/06/201748.134973315.135
205/06/201748.1652533.1171915.0481
306/06/201748.1955233.2343814.9611
407/06/201748.225834.4062813.8195
508/06/201748.2560734.5234713.7326
609/06/201748.2863534.6406713.6457
710/06/201748.3166235.1094313.2072
811/06/201748.3468935.2266213.1203
912/06/2017#N/A#N/A#N/A
1013/06/201748.4074435.46112.946414/06/2017While Omitting #N/A cells, it takes the minimum absolute difference between columns C and D,
1114/06/201748.4377235.5781912.8595<<min diffand returns its relative position in Column A, e.g 12.85 was the smallest absolute difference
1215/06/201748.4679934.2890914.1789so it has returned the date, 14/06/2017
1316/06/201748.4982634.4062814.092
1417/06/201748.5285434.5234714.0051
1518/06/201748.5588134.6406713.9181
1619/06/2017#N/A#N/A#N/A
1720/06/201748.6193635.2266213.3927
1821/06/201748.6496435.3438113.3058
1922/06/201748.6799135.46113.2189
2023/06/201748.7101835.5781913.132
Sheet1
Cell Formulas
RangeFormula
H10H10=INDEX(A1:A20,MATCH((MIN(IFERROR(IF(ISERROR(ABS(C1:C20-D1:D20)),"",ABS(C1:C20-D1:D20)),ABS(C1:C20-D1:D20)))),ABS(C1:C20-D1:D20),0))
F1:F20F1=ABS(D1-C1)
Press CTRL+SHIFT+ENTER to enter array formulas.
 
Upvote 0

Forum statistics

Threads
1,215,069
Messages
6,122,958
Members
449,096
Latest member
Anshu121

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