ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Macro For If Function (https://www.excelbanter.com/excel-programming/384017-macro-if-function.html)

Akash

Macro For If Function
 
hi,

I have 6 Columns

A = Number
B = Number
C= Number
D= A x B x C
E= Input Number by user
F = If(D = E) = Matched/Unmatched)

I want a macro the value of Column D = E then it should display
Matched or Unmatched in Column F.

Is it possible.

Thanks in Advance


John Coleman

Macro For If Function
 
A spreadsheet formula should work: in F1 (say) enter the formula

=If(D1=E1,"Matched","Unmatched")

and copy it down for as many rows as you need. If this doesn't
suffice, explain what you need in more detail.

Hth

-John Coleman



On Feb 27, 6:53 am, "Akash" wrote:
hi,

I have 6 Columns

A = Number
B = Number
C= Number
D= A x B x C
E= Input Number by user
F = If(D = E) = Matched/Unmatched)

I want a macro the value of Column D = E then it should display
Matched or Unmatched in Column F.

Is it possible.

Thanks in Advance




Mike

Macro For If Function
 
in F1

=IF(D1=E1,"Matched","Unmatched")


"Akash" wrote:

hi,

I have 6 Columns

A = Number
B = Number
C= Number
D= A x B x C
E= Input Number by user
F = If(D = E) = Matched/Unmatched)

I want a macro the value of Column D = E then it should display
Matched or Unmatched in Column F.

Is it possible.

Thanks in Advance



Akash

Macro For If Function
 
On Feb 27, 5:13 pm, "John Coleman" wrote:
A spreadsheet formula should work: in F1 (say) enter the formula

=If(D1=E1,"Matched","Unmatched")

and copy it down for as many rows as you need. If this doesn't
suffice, explain what you need in more detail.

Hth

-John Coleman

On Feb 27, 6:53 am, "Akash" wrote:

hi,


I have 6 Columns


A = Number
B = Number
C= Number
D= A x B x C
E= Input Number by user
F = If(D = E) = Matched/Unmatched)


I want a macro the value of Column D = E then it should display
Matched or Unmatched in Column F.


Is it possible.


Thanks in Advance



i require a macro for the same...

is it possible...

Akash


Mike

Macro For If Function
 
Right click the sheet tab and paste this in

Private Sub Worksheet_Change(ByVal Target As Excel.Range)
If Not Application.Intersect(Target, Range("E1")) Is Nothing Then
If Target.Value = Cells(1, 4).Value Then
Cells(1, 6).Value = "Matched"
Else
Cells(1, 6).Value = "Unmatched"
End If
End If
End Sub

Mike

"Akash" wrote:

On Feb 27, 5:13 pm, "John Coleman" wrote:
A spreadsheet formula should work: in F1 (say) enter the formula

=If(D1=E1,"Matched","Unmatched")

and copy it down for as many rows as you need. If this doesn't
suffice, explain what you need in more detail.

Hth

-John Coleman

On Feb 27, 6:53 am, "Akash" wrote:

hi,


I have 6 Columns


A = Number
B = Number
C= Number
D= A x B x C
E= Input Number by user
F = If(D = E) = Matched/Unmatched)


I want a macro the value of Column D = E then it should display
Matched or Unmatched in Column F.


Is it possible.


Thanks in Advance



i require a macro for the same...

is it possible...

Akash



John Coleman

Macro For If Function
 
Why do you need a macro to duplicate the functionality?

Something like this could work:

Sub CheckMatches()
Dim R As Range
Dim cl As Range
Set R = Range("F1:F5")
For Each cl In R.Cells
If cl.Offset(0, -2).Value = cl.Offset(0, -1).Value Then
cl.Value = "Matched"
Else
cl.Value = "Unmatched"
End If
Next cl
End Sub

adjust the range statement to get the F-range you want. You can make
the sub more flexible by passing the range of rows as parameters

Hth

-John Coleman


On Feb 27, 7:41 am, "Akash" wrote:
On Feb 27, 5:13 pm, "John Coleman" wrote:





A spreadsheet formula should work: in F1 (say) enter the formula


=If(D1=E1,"Matched","Unmatched")


and copy it down for as many rows as you need. If this doesn't
suffice, explain what you need in more detail.


Hth


-John Coleman


On Feb 27, 6:53 am, "Akash" wrote:


hi,


I have 6 Columns


A = Number
B = Number
C= Number
D= A x B x C
E= Input Number by user
F = If(D = E) = Matched/Unmatched)


I want a macro the value of Column D = E then it should display
Matched or Unmatched in Column F.


Is it possible.


Thanks in Advance


i require a macro for the same...

is it possible...

Akash- Hide quoted text -

- Show quoted text -





All times are GMT +1. The time now is 01:54 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com