if values in Column D matches then

GirishDhruva

Active Member
Joined
Mar 26, 2019
Messages
308
Hi everyone,
I had created same thread https://www.mrexcel.com/forum/excel-questions/1098491-if-values-column-d-matches-then.html but as i couldn't view that thread i have created this.

Here i am trying to check the values in column 'D' and if the values in column 'D' matches then in column B it should print the value '60' else it should print '10'.


Like

Column AColumn BColumn D
1604359
21045132
310'4324
4101324
5105123
660'4359
71006471
81012345
960'4359
101053121
11604359
1210'5123
1310512323
14604359

<tbody>
</tbody>

The values in column 'D' can also be text

Thanks in advance
 

Excel Facts

Formula for Yesterday
Name Manager, New Name. Yesterday =TODAY()-1. OK. Then, use =YESTERDAY in any cell. Tomorrow could be =TODAY()+1.
Hi Everyone,
I am not very much good in coding but i am trying below code as it's throwing me an error in highlighted, can i know why????
Rich (BB code):
lrow = Cells(Rows.Count, "D").End(xlUp).Row
For i = 4 To lrow
    If Cells(i, 1).Value = "4359" Then
        Range(Cells(Rows(i), "B")).Value = "60"
    Else
        Range(Cells(Rows(i), "B")).Value = "10"
    End If
Next i
 
Last edited:
Upvote 0
Try this:
Code:
Sub My_Sub()
'Modified  5/22/2019  2:01:01 AM  EDT
lrow = Cells(Rows.Count, "D").End(xlUp).Row
For i = 4 To lrow
    If Cells(i, "D").Value = "4359" Then
        Cells(i, "B").Value = "60"
    Else
        Cells(i, "B").Value = "10"
    End If
Next i
End Sub
 
Upvote 0
Glad I was able to help. But in your original post you said:

Here i am trying to check the values in column 'D' and if the values in column 'D' matches

But you did not say matches "4359"

There are numerous different values in column D

I would think in this case you would have said matches "4359"
 
Upvote 0
Glad I was able to help. But in your original post you said:

Here i am trying to check the values in column 'D' and if the values in column 'D' matches

But you did not say matches "4359"

There are numerous different values in column D

I would think in this case you would have said matches "4359"

Ya i think i have confused , sorry for that
 
Upvote 0

Forum statistics

Threads
1,214,523
Messages
6,120,038
Members
448,940
Latest member
mdusw

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