Finding closest value to the left or right, based on index match, which returned a blank value.

Chriskkw

New Member
Joined
Jul 26, 2020
Messages
4
Office Version
  1. 2013
Platform
  1. Windows
Hi guys, i,m new and i have a very interesting one for you. i did the usual index match and it returned a blank value. Based on that blank value. it would return the closest number based on number of blank cells.

here's an extract. been through many searches cant seem to find a solution.

1595763564168.png


So as you can see. the value returned is the cell to the right of 16.17, and i need it to return 16.17 but it need i to be dynamic. as you can see, the next blanks are on top, and i need it to return 340. i have like 500 rows with about 120 columns of data so i cant use a static formula.

Anyone has any idea how to?

thanks for the replies in advanced!
 

Excel Facts

How to fill five years of quarters?
Type 1Q-2023 in a cell. Grab the fill handle and drag down or right. After 4Q-2023, Excel will jump to 1Q-2024. Dash can be any character.
So are we looking for rows that only contain 1 number, lowest value first?

Book1
ABCDEFG
20.691805
30.2450820.8418260.1339110.7609460.4710260.58390.941654
40.5647730.2264180.76830.4043710.0168220.6859660.936436
50.1433860.6039250.7470460.0518660.0139910.0551070.407227
60.619415
7
80.619415
90.691805
10 
Sheet2
Cell Formulas
RangeFormula
B8:B10B8=IFERROR(AGGREGATE(15,6,$A$2:$G$6/(SUBTOTAL(2,OFFSET($A$2,ROW($A$2:$A$6)-ROW($A$2),0,1,COLUMNS($A$2:$G$2)))=1),ROWS(B$8:B8)+COUNTIF($A$2:$G$6,"")),"")
 
Upvote 0
Hi Jason, thanks so much for your reply!! However, what i did was a index match before that, i was hoping to find the value based on the Blank text.

so if i'm looking for example 28/5/2020, Arthur, for the first cell reference, i would want a return value of either 71 or 75. any ideas?

i figured how to paste excel formulas, hope it works.

Book1
BCDEFGHIJKLMNOP
2Date28/5/2020Value
3NameArthur0
40
515.05
6#NUM!
7
8Name20/5/202021/5/202022/5/202025/5/202026/5/202027/5/202028/5/202029/5/20201/6/20202/6/20203/6/20204/6/2020
9Arthur00710000750000
10Arthur00000002100000
11Cayden456452454456456460460464456458460468
12Cayden003.104000000000
13Barry36.88238.46235.634037.50234.95434.54435.83639.56441.9743.3244.06
14Barry17.0917.4117.29016.8817.1117.3618.2317.7917.9418.1817.65
15Cayden22.6222.8422.57022.1222.1222.3823.082323.1522.9622.97
16Dennis00145400000144560000
17Dennis391.6389396.60388.6385.2392.6392391.4379.6382.6379
18Cayden13.6213.613.7013.5613.3613.4113.3913.3513.3213.5213.9
19Arthur15.2515.2515.35015.2515.0515.0515.115.115.115.315.7
20Barry5.625.7725.6425.7825.775.6165.8465.7566.6386.7946.7646.932
21Dennis58.07560.97557.975062.37561.47558.67559.42563.92567.3568.7567.9
Sheet1
Cell Formulas
RangeFormula
E3:E6E3=INDEX($E$9:$P$21,AGGREGATE(15,3,($C$9:$C$21=$C$3)/($C$9:$C$21=$C$3)*ROW($C$9:$C$21)-ROW($C$8),ROWS($B$9:B9)),MATCH($C$2,$E$8:$P$8))
 
Upvote 0
find the value based on the Blank text
Your example above doesn't have blanks, so should it be based on blank or zero?

Blank (with a formula), empty and zero often need to be dealt with in different ways, especially if there can be genuine zero values in the data mixed with blank / empty cells.
 
Upvote 0
Ah I'm sorry, I'm still getting used to the terms as an amateur, I didn't know it is treated differently.

It is blanks.

I took the blanks and divided it by a constant hence it showed 0. Sorry about that. Thanks for getting back so quick. Really appreciate it!
 
Upvote 0
so if i'm looking for example 28/5/2020, Arthur, for the first cell reference, i would want a return value of either 71 or 75. any ideas?
Looking at your example again, could you explain why 71 or 75 and not 210 (in L10)?

I'm assuming that row 19 is excluded because the column for the date in C2 is not blank?

First attempt, based on a few assumptions.

Book1
BCDEFGHIJKLMNOP
2Date28/05/2020Value
3NameArthur71
475
5
6
7
8Name20/05/202021/05/202022/05/202025/05/202026/05/202027/05/202028/05/202029/05/202001/06/202002/06/202003/06/202004/06/2020
9Arthur7175
10Arthur210
11Cayden456452454456456460460464456458460468
12Cayden3.104
13Barry36.88238.46235.63437.50234.95434.54435.83639.56441.9743.3244.06
14Barry17.0917.4117.2916.8817.1117.3618.2317.7917.9418.1817.65
15Cayden22.6222.8422.5722.1222.1222.3823.082323.1522.9622.97
16Dennis1454014456
17Dennis391.6389396.6388.6385.2392.6392391.4379.6382.6379
18Cayden13.6213.613.713.5613.3613.4113.3913.3513.3213.5213.9
19Arthur15.2515.2515.3515.2515.0515.0515.115.115.115.315.7
20Barry5.625.7725.6425.7825.775.6165.8465.7566.6386.7946.7646.932
21Dennis58.07560.97557.97562.37561.47558.67559.42563.92567.3568.7567.9
Sheet3
Cell Formulas
RangeFormula
E3E3=LOOKUP(1E+100,INDEX($E$9:INDEX($E$9:$P$21,0,MATCH($C$2,$E$8:$P$8,0)-1),MATCH($C$3,$C$9:$C$21,0),0))
E4E4=LOOKUP(1E+100,INDEX(INDEX($E$9:$P$21,0,MATCH($C$2,$E$8:$P$8,0)+1):$P$21,MATCH($C$3,$C$9:$C$21,0),0))
 
Upvote 0
Hi Jason, yes you are right, so basically my formula throws out all values for "Arthur". but 71 or 75 was referring to row 1, whereas if i scroll down, it will refer to row 2, which choosing the nearest value would be 210.

So example if i choose 22/5/2020, Cayden for my helper cells. it would return 4 results.

what i'm trying to achieve is that if i choose "Cayden" "21/5/2020", it would throw out "452", "3.104", "22.84", "13.6", in which "3.104" would be the nearest value when it's blank.

Test 1.xlsx
BCDEFGHIJKLMNOP
2Date22/5/2020Value
3NameCayden454
43.104
522.57
613.7
7
8Name20/5/202021/5/202022/5/202025/5/202026/5/202027/5/202028/5/202029/5/20201/6/20202/6/20203/6/20204/6/2020
9Arthur7175
10Arthur210
11Cayden456452454456456460460464456458460468
12Cayden3.104
13Barry36.88238.46235.63437.50234.95434.54435.83639.56441.9743.3244.06
14Barry17.0917.4117.2916.8817.1117.3618.2317.7917.9418.1817.65
15Cayden22.6222.8422.5722.1222.1222.3823.082323.1522.9622.97
16Dennis1454014456
17Dennis391.6389396.6388.6385.2392.6392391.4379.6382.6379
18Cayden13.6213.613.713.5613.3613.4113.3913.3513.3213.5213.9
19Arthur15.2515.2515.3515.2515.0515.0515.115.115.115.315.7
20Barry5.625.7725.6425.7825.775.6165.8465.7566.6386.7946.7646.932
21Dennis58.07560.97557.97562.37561.47558.67559.42563.92567.3568.7567.9
Sheet1
Cell Formulas
RangeFormula
E3E3=(INDEX($E$9:$P$21,AGGREGATE(15,3,($C$9:$C$21=$C$3)/($C$9:$C$21=$C$3)*ROW($C$9:$C$21)-ROW($C$8),ROWS($B$9:B9)),MATCH($C$2,$E$8:$P$8)))
E4:E6E4=INDEX($E$9:$P$21,AGGREGATE(15,3,($C$9:$C$21=$C$3)/($C$9:$C$21=$C$3)*ROW($C$9:$C$21)-ROW($C$8),ROWS($B$9:B10)),MATCH($C$2,$E$8:$P$8))
 
Upvote 0

Forum statistics

Threads
1,223,803
Messages
6,174,687
Members
452,577
Latest member
Filipzgela

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