Invalid Procedure Call - Trying to join using Mid and Instr

bravura

Board Regular
Joined
Jan 27, 2010
Messages
51
tblA has commodities such as ME Milled Rice, and tblB has just ME and second field with load factor

=Mid(tblA.Commodity, 1, InStr(1, " ", tblA.Commodity) - 1) = tblB.Commodity

tblA
field1field2Commodity
abc123MR - Milled Rice
tblB
CommodityLF
MR22

<tbody>
</tbody>
 
Last edited:

Excel Facts

Can a formula spear through sheets?
Use =SUM(January:December!E7) to sum E7 on all of the sheets from January through December
Looks like you have the arguments to instr() in the wrong order: it should be (1, searched, sought). So ....

=
Code:
Mid(tblA.Commodity, 1, InStr(1, tblA.Commodity, " ") - 1) = tblB.Commodity
 
Last edited:
Upvote 0
not much here to go on, but one thing I'm pretty sure of is that you'll get that message if you try to pass a negative value to the Mid function. This could occur if the Instr function doesn't find the character that you're searching for, because you are subtracting 1 regardless. Are you certain the error occurs with the data you've shown?
 
Upvote 0

Forum statistics

Threads
1,216,175
Messages
6,129,312
Members
449,499
Latest member
HockeyBoi

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