Excel compare sheets find value & replace value, same row - different cell












0















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!










share|improve this question























  • I think this article should be useful: ablebits.com/office-addins-blog/2016/02/25/…

    – Siavash Safi
    Jan 30 at 15:27
















0















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!










share|improve this question























  • I think this article should be useful: ablebits.com/office-addins-blog/2016/02/25/…

    – Siavash Safi
    Jan 30 at 15:27














0












0








0








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!










share|improve this question














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






share|improve this question













share|improve this question











share|improve this question




share|improve this question










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



















  • 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










1 Answer
1






active

oldest

votes


















0














With Sheet1 like:



enter image description here



and Sheet2 like:



enter image description here



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:



enter image description here






share|improve this answer
























  • Amazing work my friend. Thanks so much fine sir!

    – Slim
    Jan 30 at 16:38











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
});


}
});














draft saved

draft discarded


















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









0














With Sheet1 like:



enter image description here



and Sheet2 like:



enter image description here



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:



enter image description here






share|improve this answer
























  • Amazing work my friend. Thanks so much fine sir!

    – Slim
    Jan 30 at 16:38
















0














With Sheet1 like:



enter image description here



and Sheet2 like:



enter image description here



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:



enter image description here






share|improve this answer
























  • Amazing work my friend. Thanks so much fine sir!

    – Slim
    Jan 30 at 16:38














0












0








0







With Sheet1 like:



enter image description here



and Sheet2 like:



enter image description here



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:



enter image description here






share|improve this answer













With Sheet1 like:



enter image description here



and Sheet2 like:



enter image description here



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:



enter image description here







share|improve this answer












share|improve this answer



share|improve this answer










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



















  • 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


















draft saved

draft discarded




















































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.




draft saved


draft discarded














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





















































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







Popular posts from this blog

Probability when a professor distributes a quiz and homework assignment to a class of n students.

Aardman Animations

Are they similar matrix