Greater than option (-1) not working in Excel Index Match VBA Formula

cristopulo

New Member
Joined
Aug 12, 2015
Messages
14
Hello,

I am using an Index/Match formula and at the last function when I don't want to match the exact value (0 - because it rarely would) or take the lesser value (1 - because it is not as accurate) the formula usually outputs an #N/A! error when I have the input as -1 as to take the greater value to the right.

The formula is inputted in VBA (i have tried it as a regular excel formula as well):

Range("E9").Formula = "=INDEX('Data References'!$S$2:$AG$14,MATCH(B7,'Data References'!$R$2:$R$14,0),MATCH(B13,'Data References'!$S$1:$AG$1,-1))"

Basically the very last bolded # is the one I am having trouble dealing with.

Any ideas to what the problem?

Thanks in Advance!
-Chris
 

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.
It's most likely to be due to your data in S1:AG1 not being sorted correctly.

Dom
 
Upvote 0
I am sorry, dont think I understand. All the values in the range are in increasing order. The problem for example comes when the reference cell outputs 6,47 and it doesnt take the greater value, only the value to the left instead.

Ill Post an example of the first couple lines of the table (S1 starts at the 2nd Column):


33,567910111518202228303656
Incandescent & HalogenESB 20
2 Pole
ESB 20
2 Pole
ESB 20ESB 24ESB 40
2 Pole
ESB 40
2 Pole
ESB 40
3/ 4 Pole
ESB 40
3/ 4 Pole
ESB 40
3/ 4 Pole
ESB 40ESB 63
3/ 4 Pole
ESB 63
3/ 4 Pole
ESB 63ESB 63
4 Pole
ESB 63
4 Pole
Fluo. w/ Ball. (single uncomp.)ESB 20
2 Pole
ESB 20
2 Pole
ESB 20
2 Pole
ESB 20
2 Pole
ESB 20ESB 24
2 Pole
ESB 24
2 Pole
ESB 24
3/ 4 Pole
ESB 24
3/ 4 Pole
ESB 24
3/ 4 Pole
ESB 24ESB 40
2 Pole
ESB 40
3/ 4 Pole
ESB 40ESB 63

<tbody>
</tbody>

<tbody>
</tbody>


-Chris
 
Upvote 0
Ohh Ok, this would make a lot of sense then.

If I flip the table and the values tho and input the -1 format it would give the GREATER value and not the one to the right, correct?

Thanks for your help,
-Chris
 
Upvote 0

Forum statistics

Threads
1,215,044
Messages
6,122,827
Members
449,096
Latest member
Erald

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