Thread: MATCH formula
View Single Post
  #10   Report Post  
Posted to microsoft.public.excel.misc
Mike H Mike H is offline
external usenet poster
 
Posts: 11,501
Default MATCH formula

Hi,

It was because your range started in A4, Index returned the position of the
lookup value in the array so if it finds in in A4 it returns 1 so adding 3
gives me the correct row in the worksheet in the worksheet.

Mike

"peyman" wrote:

thanx Mike it works great!! but why did you add myValue + 3? I don't get it.


"Mike H" wrote:

Hi,

I've only just understood what you want. try this.

View|Toolbars|Forma and put a button on your sheet. Click 'New' on the popup
and paste the code below in and try it

LookupValue = ActiveCell.Value
On Error Resume Next
myvalue = WorksheetFunction.Match(LookupValue, _
Sheets("Sheet2").Range("A4:A100"), 0)
Sheets("Sheet2").Select
Sheets("Sheet2").Range("A" & myvalue + 3).Select

Mike

"peyman" wrote:

Mike,
I used the macro but nothing happened!!
I'm not transfered to sheet2!! where the result can be seen?!

"Mike H" wrote:

Hi,

I assume when you say you want the formula functions for the cell you are on
then this is the lookup value

Private Sub CommandButton1_Click()
LookupValue = ActiveCell.Value
On Error Resume Next
myvalue = WorksheetFunction.Match(LookupValue, _
Sheets("Sheet2").Range("A4:A100"), 0)
End Sub

Mike

"peyman" wrote:

hi,
I've got a formula like: =match(A6, SHEET2A4:A100,0) and I want to have a
COMMAND BUTTON and instead of A6 in the formula ,I like to have a variable(I
mean a dynamic value) like activecell so that when I press the COMMAND
BUTTON, the formula functions for the cell I'm on.
Is there a way?
Thanks,
Peiman