Excel compare sheets find value & replace value, same row - different cell
Is there a way, Example:
Value 123 lives in cell A1 on sheet1
I need to find value 123 on sheet2 leave value alone but replace another cell with a set value based on what row 123 was found.
Hoping it could work like this:
123(A1 sheet1) 123 found on sheet2 in cell H13 replace A13 on sheet2 with ABC
456(A2 sheet1) 456 found on sheet2 in cell H28 replace A28 on sheet2 with ABC
Thanks so much!
microsoft-excel
add a comment |
Is there a way, Example:
Value 123 lives in cell A1 on sheet1
I need to find value 123 on sheet2 leave value alone but replace another cell with a set value based on what row 123 was found.
Hoping it could work like this:
123(A1 sheet1) 123 found on sheet2 in cell H13 replace A13 on sheet2 with ABC
456(A2 sheet1) 456 found on sheet2 in cell H28 replace A28 on sheet2 with ABC
Thanks so much!
microsoft-excel
I think this article should be useful: ablebits.com/office-addins-blog/2016/02/25/…
– Siavash Safi
Jan 30 at 15:27
add a comment |
Is there a way, Example:
Value 123 lives in cell A1 on sheet1
I need to find value 123 on sheet2 leave value alone but replace another cell with a set value based on what row 123 was found.
Hoping it could work like this:
123(A1 sheet1) 123 found on sheet2 in cell H13 replace A13 on sheet2 with ABC
456(A2 sheet1) 456 found on sheet2 in cell H28 replace A28 on sheet2 with ABC
Thanks so much!
microsoft-excel
Is there a way, Example:
Value 123 lives in cell A1 on sheet1
I need to find value 123 on sheet2 leave value alone but replace another cell with a set value based on what row 123 was found.
Hoping it could work like this:
123(A1 sheet1) 123 found on sheet2 in cell H13 replace A13 on sheet2 with ABC
456(A2 sheet1) 456 found on sheet2 in cell H28 replace A28 on sheet2 with ABC
Thanks so much!
microsoft-excel
microsoft-excel
asked Jan 30 at 15:17
SlimSlim
31
31
I think this article should be useful: ablebits.com/office-addins-blog/2016/02/25/…
– Siavash Safi
Jan 30 at 15:27
add a comment |
I think this article should be useful: ablebits.com/office-addins-blog/2016/02/25/…
– Siavash Safi
Jan 30 at 15:27
I think this article should be useful: ablebits.com/office-addins-blog/2016/02/25/…
– Siavash Safi
Jan 30 at 15:27
I think this article should be useful: ablebits.com/office-addins-blog/2016/02/25/…
– Siavash Safi
Jan 30 at 15:27
add a comment |
1 Answer
1
active
oldest
votes
With Sheet1
like:
and Sheet2
like:
Running this VBA macro:
Sub EasyAsABC()
Dim i As Long, N As Long, FoundIt As Range
Dim s1 As Worksheet, s2 As Worksheet
Set s1 = Sheets("Sheet1")
Set s2 = Sheets("Sheet2")
N = s1.Cells(Rows.Count, "A").End(xlUp).Row
For i = 1 To N
Set FoundIt = s2.Range("H:H").Find(what:=s1.Cells(i, 1).Value, after:=s2.Range("H1"), lookat:=xlWhole)
If FoundIt Is Nothing Then
Else
s2.Cells(FoundIt.Row, 1).Value = "ABC"
End If
Next i
End Sub
Will produce:
Amazing work my friend. Thanks so much fine sir!
– Slim
Jan 30 at 16:38
add a comment |
Your Answer
StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "3"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});
function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});
}
});
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fsuperuser.com%2fquestions%2f1400127%2fexcel-compare-sheets-find-value-replace-value-same-row-different-cell%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
With Sheet1
like:
and Sheet2
like:
Running this VBA macro:
Sub EasyAsABC()
Dim i As Long, N As Long, FoundIt As Range
Dim s1 As Worksheet, s2 As Worksheet
Set s1 = Sheets("Sheet1")
Set s2 = Sheets("Sheet2")
N = s1.Cells(Rows.Count, "A").End(xlUp).Row
For i = 1 To N
Set FoundIt = s2.Range("H:H").Find(what:=s1.Cells(i, 1).Value, after:=s2.Range("H1"), lookat:=xlWhole)
If FoundIt Is Nothing Then
Else
s2.Cells(FoundIt.Row, 1).Value = "ABC"
End If
Next i
End Sub
Will produce:
Amazing work my friend. Thanks so much fine sir!
– Slim
Jan 30 at 16:38
add a comment |
With Sheet1
like:
and Sheet2
like:
Running this VBA macro:
Sub EasyAsABC()
Dim i As Long, N As Long, FoundIt As Range
Dim s1 As Worksheet, s2 As Worksheet
Set s1 = Sheets("Sheet1")
Set s2 = Sheets("Sheet2")
N = s1.Cells(Rows.Count, "A").End(xlUp).Row
For i = 1 To N
Set FoundIt = s2.Range("H:H").Find(what:=s1.Cells(i, 1).Value, after:=s2.Range("H1"), lookat:=xlWhole)
If FoundIt Is Nothing Then
Else
s2.Cells(FoundIt.Row, 1).Value = "ABC"
End If
Next i
End Sub
Will produce:
Amazing work my friend. Thanks so much fine sir!
– Slim
Jan 30 at 16:38
add a comment |
With Sheet1
like:
and Sheet2
like:
Running this VBA macro:
Sub EasyAsABC()
Dim i As Long, N As Long, FoundIt As Range
Dim s1 As Worksheet, s2 As Worksheet
Set s1 = Sheets("Sheet1")
Set s2 = Sheets("Sheet2")
N = s1.Cells(Rows.Count, "A").End(xlUp).Row
For i = 1 To N
Set FoundIt = s2.Range("H:H").Find(what:=s1.Cells(i, 1).Value, after:=s2.Range("H1"), lookat:=xlWhole)
If FoundIt Is Nothing Then
Else
s2.Cells(FoundIt.Row, 1).Value = "ABC"
End If
Next i
End Sub
Will produce:
With Sheet1
like:
and Sheet2
like:
Running this VBA macro:
Sub EasyAsABC()
Dim i As Long, N As Long, FoundIt As Range
Dim s1 As Worksheet, s2 As Worksheet
Set s1 = Sheets("Sheet1")
Set s2 = Sheets("Sheet2")
N = s1.Cells(Rows.Count, "A").End(xlUp).Row
For i = 1 To N
Set FoundIt = s2.Range("H:H").Find(what:=s1.Cells(i, 1).Value, after:=s2.Range("H1"), lookat:=xlWhole)
If FoundIt Is Nothing Then
Else
s2.Cells(FoundIt.Row, 1).Value = "ABC"
End If
Next i
End Sub
Will produce:
answered Jan 30 at 15:54
Gary's StudentGary's Student
13.7k31730
13.7k31730
Amazing work my friend. Thanks so much fine sir!
– Slim
Jan 30 at 16:38
add a comment |
Amazing work my friend. Thanks so much fine sir!
– Slim
Jan 30 at 16:38
Amazing work my friend. Thanks so much fine sir!
– Slim
Jan 30 at 16:38
Amazing work my friend. Thanks so much fine sir!
– Slim
Jan 30 at 16:38
add a comment |
Thanks for contributing an answer to Super User!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fsuperuser.com%2fquestions%2f1400127%2fexcel-compare-sheets-find-value-replace-value-same-row-different-cell%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
I think this article should be useful: ablebits.com/office-addins-blog/2016/02/25/…
– Siavash Safi
Jan 30 at 15:27