VBA code on comparing two columnsFind function for strings in cellsVBA Text Array - Scan two columns rather...
Efficient way to transport a Stargate
Sort a list by elements of another list
Is this apparent Class Action settlement a spam message?
Why use "finir par" instead of "finir de" before an infinitive?
What happens if you roll doubles 3 times then land on "Go to jail?"
Why not increase contact surface when reentering the atmosphere?
Why are there no referendums in the US?
Are there languages with no euphemisms?
Only print output after finding pattern
Why Were Madagascar and New Zealand Discovered So Late?
How to minimizeplan ahead the effect of running sp_delete_backuphistory? Measure the gains too!
How can I open an app using Terminal?
Is a stroke of luck acceptable after a series of unfavorable events?
Can the discrete variable be a negative number?
How did Doctor Strange see the winning outcome in Avengers: Infinity War?
What is the opposite of 'gravitas'?
Is there a good way to store credentials outside of a password manager?
Number of words that can be made using all the letters of the word W, if Os as well as Is are separated is?
What does 算不上 mean in 算不上太美好的日子?
How do I go from 300 unfinished/half written blog posts, to published posts?
How does it work when somebody invests in my business?
How does the UK government determine the size of a mandate?
Large drywall patch supports
Opposite of a diet
VBA code on comparing two columns
Find function for strings in cellsVBA Text Array - Scan two columns rather than oneStandard Methods in VBAFunction to find the kth matchFunction to find the kth match (2)Compare and find duplicates in 2 corresponding columns in 2 sheetsComparing two lists under 6 columns with 32000 rows in ExcelMapping one array onto another where columns from first array become rows in second arraySudoku-lite challengeHousing a summary of information in a data file
$begingroup$
NEED VBA CODE FOR THIS PROBLEM.
I have two different columns in a spreadsheet, and I want to compare the values of the two and want to display in the third column, whether the values are present I both the columns or if present in one column and absent in another, and vice versa. Please respond as early as possible, its urgent.
Dim ListA As Range
Dim ListB As Range
Dim c As Range
Call Unprotect
ListARange = Cells(Rows.Count, "A").End(xlUp).Row 'find the last row with data on column A
ListBRange = Cells(Rows.Count, "B").End(xlUp).Row 'find the last row with data on column B
Set ListA = Range("A2:A" & ListARange) 'set your range only until the last row with data
Set ListB = Range("B2:B" & ListBRange)
Application.ScreenUpdating = False
Range("C1").Value = "Files in A that are NOT in B"
Range("D1").Value = "Files in B that are Not in A"
Range("E1").Value = "Matching Files"
For Each c In ListA
If Application.CountIf(ListB, c) = 0 Then
Cells(Cells(Rows.Count, "C").End(xlUp).Row + 1, "C").Value = c
ElseIf Application.CountIf(ListB, c) >= 1 Then
Cells(Cells(Rows.Count, "E").End(xlUp).Row + 1, "E").Value = c
End If
Next c
For Each c In ListB
If Application.CountIf(ListA, c) = 0 Then Cells(Cells(Rows.Count, "D").End(xlUp).Row + 1, "D").Value = c
Next c
Application.ScreenUpdating = True
Call Protect
vba excel
New contributor
$endgroup$
add a comment |
$begingroup$
NEED VBA CODE FOR THIS PROBLEM.
I have two different columns in a spreadsheet, and I want to compare the values of the two and want to display in the third column, whether the values are present I both the columns or if present in one column and absent in another, and vice versa. Please respond as early as possible, its urgent.
Dim ListA As Range
Dim ListB As Range
Dim c As Range
Call Unprotect
ListARange = Cells(Rows.Count, "A").End(xlUp).Row 'find the last row with data on column A
ListBRange = Cells(Rows.Count, "B").End(xlUp).Row 'find the last row with data on column B
Set ListA = Range("A2:A" & ListARange) 'set your range only until the last row with data
Set ListB = Range("B2:B" & ListBRange)
Application.ScreenUpdating = False
Range("C1").Value = "Files in A that are NOT in B"
Range("D1").Value = "Files in B that are Not in A"
Range("E1").Value = "Matching Files"
For Each c In ListA
If Application.CountIf(ListB, c) = 0 Then
Cells(Cells(Rows.Count, "C").End(xlUp).Row + 1, "C").Value = c
ElseIf Application.CountIf(ListB, c) >= 1 Then
Cells(Cells(Rows.Count, "E").End(xlUp).Row + 1, "E").Value = c
End If
Next c
For Each c In ListB
If Application.CountIf(ListA, c) = 0 Then Cells(Cells(Rows.Count, "D").End(xlUp).Row + 1, "D").Value = c
Next c
Application.ScreenUpdating = True
Call Protect
vba excel
New contributor
$endgroup$
add a comment |
$begingroup$
NEED VBA CODE FOR THIS PROBLEM.
I have two different columns in a spreadsheet, and I want to compare the values of the two and want to display in the third column, whether the values are present I both the columns or if present in one column and absent in another, and vice versa. Please respond as early as possible, its urgent.
Dim ListA As Range
Dim ListB As Range
Dim c As Range
Call Unprotect
ListARange = Cells(Rows.Count, "A").End(xlUp).Row 'find the last row with data on column A
ListBRange = Cells(Rows.Count, "B").End(xlUp).Row 'find the last row with data on column B
Set ListA = Range("A2:A" & ListARange) 'set your range only until the last row with data
Set ListB = Range("B2:B" & ListBRange)
Application.ScreenUpdating = False
Range("C1").Value = "Files in A that are NOT in B"
Range("D1").Value = "Files in B that are Not in A"
Range("E1").Value = "Matching Files"
For Each c In ListA
If Application.CountIf(ListB, c) = 0 Then
Cells(Cells(Rows.Count, "C").End(xlUp).Row + 1, "C").Value = c
ElseIf Application.CountIf(ListB, c) >= 1 Then
Cells(Cells(Rows.Count, "E").End(xlUp).Row + 1, "E").Value = c
End If
Next c
For Each c In ListB
If Application.CountIf(ListA, c) = 0 Then Cells(Cells(Rows.Count, "D").End(xlUp).Row + 1, "D").Value = c
Next c
Application.ScreenUpdating = True
Call Protect
vba excel
New contributor
$endgroup$
NEED VBA CODE FOR THIS PROBLEM.
I have two different columns in a spreadsheet, and I want to compare the values of the two and want to display in the third column, whether the values are present I both the columns or if present in one column and absent in another, and vice versa. Please respond as early as possible, its urgent.
Dim ListA As Range
Dim ListB As Range
Dim c As Range
Call Unprotect
ListARange = Cells(Rows.Count, "A").End(xlUp).Row 'find the last row with data on column A
ListBRange = Cells(Rows.Count, "B").End(xlUp).Row 'find the last row with data on column B
Set ListA = Range("A2:A" & ListARange) 'set your range only until the last row with data
Set ListB = Range("B2:B" & ListBRange)
Application.ScreenUpdating = False
Range("C1").Value = "Files in A that are NOT in B"
Range("D1").Value = "Files in B that are Not in A"
Range("E1").Value = "Matching Files"
For Each c In ListA
If Application.CountIf(ListB, c) = 0 Then
Cells(Cells(Rows.Count, "C").End(xlUp).Row + 1, "C").Value = c
ElseIf Application.CountIf(ListB, c) >= 1 Then
Cells(Cells(Rows.Count, "E").End(xlUp).Row + 1, "E").Value = c
End If
Next c
For Each c In ListB
If Application.CountIf(ListA, c) = 0 Then Cells(Cells(Rows.Count, "D").End(xlUp).Row + 1, "D").Value = c
Next c
Application.ScreenUpdating = True
Call Protect
vba excel
vba excel
New contributor
New contributor
New contributor
asked 10 mins ago
Subhadip GhoshSubhadip Ghosh
1
1
New contributor
New contributor
add a comment |
add a comment |
0
active
oldest
votes
Your Answer
StackExchange.ifUsing("editor", function () {
return StackExchange.using("mathjaxEditing", function () {
StackExchange.MarkdownEditor.creationCallbacks.add(function (editor, postfix) {
StackExchange.mathjaxEditing.prepareWmdForMathJax(editor, postfix, [["\$", "\$"]]);
});
});
}, "mathjax-editing");
StackExchange.ifUsing("editor", function () {
StackExchange.using("externalEditor", function () {
StackExchange.using("snippets", function () {
StackExchange.snippets.init();
});
});
}, "code-snippets");
StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "196"
};
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: false,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: null,
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
});
}
});
Subhadip Ghosh is a new contributor. Be nice, and check out our Code of Conduct.
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%2fcodereview.stackexchange.com%2fquestions%2f216418%2fvba-code-on-comparing-two-columns%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
0
active
oldest
votes
0
active
oldest
votes
active
oldest
votes
active
oldest
votes
Subhadip Ghosh is a new contributor. Be nice, and check out our Code of Conduct.
Subhadip Ghosh is a new contributor. Be nice, and check out our Code of Conduct.
Subhadip Ghosh is a new contributor. Be nice, and check out our Code of Conduct.
Subhadip Ghosh is a new contributor. Be nice, and check out our Code of Conduct.
Thanks for contributing an answer to Code Review Stack Exchange!
- 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.
Use MathJax to format equations. MathJax reference.
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%2fcodereview.stackexchange.com%2fquestions%2f216418%2fvba-code-on-comparing-two-columns%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