Rewriting Formula to VBA

jarvisaurus

Board Regular
Joined
Nov 26, 2010
Messages
52
I'm having some trouble rewriting this vba formula, some assistance would be greatly appreciated. Thanks.

Current excel formula:

=--ISNUMBER(MATCH(AP2,$AP$1:AP1,0))

VBA:

Cells(i, "AS").Value = Application.WorksheetFunction.IsNumber(Application.WorksheetFunction.Match(Cells(i, "AP"), Range("$AP$1:AP1"), 0))
 

Excel Facts

Does the VLOOKUP table have to be sorted?
No! when you are using an exact match, the VLOOKUP table can be in any order. Best-selling items at the top is actually the best.
Try...

Code:
[font=Verdana]Cells(i, "AS").Value = Application.Evaluate("ISNUMBER(MATCH(AP" & i & ",$AP$1:AP1,0))+0")[/font]

Although, unless I'm mistaken, it looks like the range for the lookup array, $AP$1:AP1, should be expanding with each iteration.
 
Upvote 0
Nevermind I figured it out but thank you!

PHP:
Cells(i, "AS").Value = Application.Evaluate("ISNUMBER(MATCH(AP" & i & ",AP" & i - 1 & ",0))+0")
 
Upvote 0
Shouldn't it be...?

Code:
Cells(i, "AS").Value = Application.Evaluate("ISNUMBER(MATCH(AP" & i & ",AP1:AP" & i - 1 & ",0))+0")
 
Upvote 0

Forum statistics

Threads
1,224,537
Messages
6,179,408
Members
452,912
Latest member
alicemil

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