Compare values

Closed
Hemant - May 11, 2010 at 12:35 AM
venkat1926 Posts 1863 Registration date Sunday June 14, 2009 Status Contributor Last seen August 7, 2021 - May 11, 2010 at 06:17 AM
i want to compare value of k6 to whole column c if one value in column c matches then subtract value in column d corresponding to c with value in l6

2 responses

rizvisa1 Posts 4478 Registration date Thursday January 28, 2010 Status Contributor Last seen May 5, 2022 766
May 11, 2010 at 06:11 AM
Could you please upload a sample file with sample data etc on some shared site like https://authentification.site and post back here the link to allow better understanding of how it is now and how you foresee.
0
venkat1926 Posts 1863 Registration date Sunday June 14, 2009 Status Contributor Last seen August 7, 2021 811
May 11, 2010 at 06:17 AM
quote
then subtract value in column d corresponding
'to c with value in l6
unquote
this is ambiguous

try this macro (if necessary modify the macro)

Sub test()
Dim x, cfind As Range, y As Double
x = Range("K6").Value
Set cfind = Columns("C:C").Cells.Find(what:=x, lookat:=xlWhole)
If Not cfind Is Nothing Then
y = Range("I6") - Cells(cfind.Row, "D")
MsgBox y
Else
MsgBox "the value is not available in col. C"
End If
End Sub
0