Select values next to matching cellsFind the number of a row that contains two specific values?Excel How to find more values that contain values in the cell next to them?How to return a value from a range if cell contains that valueConditional Formatting If any cell In a column Matches any other Cell in anotherVBA code to fill down index-match functions in 7 adjacent cellsExcel formula for unique list that also checks / matches one of two possible values in separate columnIf Cell Contains XXX Then Return Corresponding Valueexcel formula to find non repeated values from two different columns or moreExcel: How to return a unique list array as a result of a two column lookupIf two cells match return value from third
Lied on resume at previous job
What do you call something that goes against the spirit of the law, but is legal when interpreting the law to the letter?
Typesetting a double Over Dot on top of a symbol
How to make payment on the internet without leaving a money trail?
Is ipsum/ipsa/ipse a third person pronoun, or can it serve other functions?
Is there a familial term for apples and pears?
Could a US political party gain complete control over the government by removing checks & balances?
Why airport relocation isn't done gradually?
Calculate Levenshtein distance between two strings in Python
Why did the Germans forbid the possession of pet pigeons in Rostov-on-Don in 1941?
Could Giant Ground Sloths have been a good pack animal for the ancient Mayans?
Unbreakable Formation vs. Cry of the Carnarium
How is it possible for user's password to be changed after storage was encrypted? (on OS X, Android)
Landlord wants to switch my lease to a "Land contract" to "get back at the city"
How to make particles emit from certain parts of a 3D object?
Why is my log file so massive? 22gb. I am running log backups
Can I legally use front facing blue light in the UK?
Denied boarding due to overcrowding, Sparpreis ticket. What are my rights?
Pristine Bit Checking
Copycat chess is back
Information to fellow intern about hiring?
How to answer pointed "are you quitting" questioning when I don't want them to suspect
Is it wise to focus on putting odd beats on left when playing double bass drums?
Is there a name of the flying bionic bird?
Select values next to matching cells
Find the number of a row that contains two specific values?Excel How to find more values that contain values in the cell next to them?How to return a value from a range if cell contains that valueConditional Formatting If any cell In a column Matches any other Cell in anotherVBA code to fill down index-match functions in 7 adjacent cellsExcel formula for unique list that also checks / matches one of two possible values in separate columnIf Cell Contains XXX Then Return Corresponding Valueexcel formula to find non repeated values from two different columns or moreExcel: How to return a unique list array as a result of a two column lookupIf two cells match return value from third
.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty height:90px;width:728px;box-sizing:border-box;
I have a spreadsheet with two columns, key
and name
. Right now, the name gets repeated multiple times per value. I set up a formula to get unique values in name, but now I need to get a list of all the values of the cells that match that column.
So if I have the name 'Brian', and there are 4 of them with index values of 5, 6, 7, and 8, I need a formula to take/use the value of C1
to look at B:B
and give me all values in A:A
.
Is this possible?
excel
|
show 6 more comments
I have a spreadsheet with two columns, key
and name
. Right now, the name gets repeated multiple times per value. I set up a formula to get unique values in name, but now I need to get a list of all the values of the cells that match that column.
So if I have the name 'Brian', and there are 4 of them with index values of 5, 6, 7, and 8, I need a formula to take/use the value of C1
to look at B:B
and give me all values in A:A
.
Is this possible?
excel
Please post an image of your data or a sample.
– Ricardo Diaz
Mar 22 at 1:48
@RicardoDiaz Added.
– Cody Harness
Mar 22 at 1:52
Could you please add a sample of how the result would look like?
– Ricardo Diaz
Mar 22 at 1:55
@RicardoDiaz My apologies, that should have been in the first image.
– Cody Harness
Mar 22 at 1:59
Are you trying to get index values fromColumn A
for values likeBrian
.
– Harun24HR
Mar 22 at 2:07
|
show 6 more comments
I have a spreadsheet with two columns, key
and name
. Right now, the name gets repeated multiple times per value. I set up a formula to get unique values in name, but now I need to get a list of all the values of the cells that match that column.
So if I have the name 'Brian', and there are 4 of them with index values of 5, 6, 7, and 8, I need a formula to take/use the value of C1
to look at B:B
and give me all values in A:A
.
Is this possible?
excel
I have a spreadsheet with two columns, key
and name
. Right now, the name gets repeated multiple times per value. I set up a formula to get unique values in name, but now I need to get a list of all the values of the cells that match that column.
So if I have the name 'Brian', and there are 4 of them with index values of 5, 6, 7, and 8, I need a formula to take/use the value of C1
to look at B:B
and give me all values in A:A
.
Is this possible?
excel
excel
edited Mar 22 at 2:14
Cody Harness
asked Mar 22 at 1:46
Cody HarnessCody Harness
54511028
54511028
Please post an image of your data or a sample.
– Ricardo Diaz
Mar 22 at 1:48
@RicardoDiaz Added.
– Cody Harness
Mar 22 at 1:52
Could you please add a sample of how the result would look like?
– Ricardo Diaz
Mar 22 at 1:55
@RicardoDiaz My apologies, that should have been in the first image.
– Cody Harness
Mar 22 at 1:59
Are you trying to get index values fromColumn A
for values likeBrian
.
– Harun24HR
Mar 22 at 2:07
|
show 6 more comments
Please post an image of your data or a sample.
– Ricardo Diaz
Mar 22 at 1:48
@RicardoDiaz Added.
– Cody Harness
Mar 22 at 1:52
Could you please add a sample of how the result would look like?
– Ricardo Diaz
Mar 22 at 1:55
@RicardoDiaz My apologies, that should have been in the first image.
– Cody Harness
Mar 22 at 1:59
Are you trying to get index values fromColumn A
for values likeBrian
.
– Harun24HR
Mar 22 at 2:07
Please post an image of your data or a sample.
– Ricardo Diaz
Mar 22 at 1:48
Please post an image of your data or a sample.
– Ricardo Diaz
Mar 22 at 1:48
@RicardoDiaz Added.
– Cody Harness
Mar 22 at 1:52
@RicardoDiaz Added.
– Cody Harness
Mar 22 at 1:52
Could you please add a sample of how the result would look like?
– Ricardo Diaz
Mar 22 at 1:55
Could you please add a sample of how the result would look like?
– Ricardo Diaz
Mar 22 at 1:55
@RicardoDiaz My apologies, that should have been in the first image.
– Cody Harness
Mar 22 at 1:59
@RicardoDiaz My apologies, that should have been in the first image.
– Cody Harness
Mar 22 at 1:59
Are you trying to get index values from
Column A
for values like Brian
.– Harun24HR
Mar 22 at 2:07
Are you trying to get index values from
Column A
for values like Brian
.– Harun24HR
Mar 22 at 2:07
|
show 6 more comments
2 Answers
2
active
oldest
votes
In your google-sheets's D1 put this formula in and drag down.
=arrayformula(textjoin(" ", true, if(B:B=C1, A:A, "")))
add a comment |
CONCIF (UDF)
In Excel
=CONCIF($B$1:$B$20,$C1,$A$1:$A$20)
In VBA
Option Explicit
Function CONCIF(MatchRange As Range, ByVal MatchValue As Variant, _
ConcatRange As Range, _
Optional ByVal Delimiter As String = " ") As String
Dim vntM As Variant ' Match Array
Dim vntC As Variant ' Concat Array
Dim Nor As Long ' Number of Rows
Dim i As Long ' Row Counter
Dim strC As String ' Concat String
Dim strR As String ' Result String
' Check number of rows in MatchRange is less than or equal to number
' of rows in Concat Range.
If MatchRange.Rows.Count <= ConcatRange.Rows.Count Then
' Write number of rows in MatchRange to Number of Rows.
Nor = MatchRange.Rows.Count
Else
' Write number of rows in ConcatRange to Number of Rows.
Nor = ConcatRange.Rows.Count
End If
' Check if Number of Rows is equal to 1, which would mean there
' can only be one match.
If Nor = 1 Then
' Check if the value in 1-cell MatchRange is equal to MatchValue.
If MatchRange.Cells(1, 1) = MatchValue Then
' Write value of 1-cell ConcatRange, converted to string, to CONCIF.
CONCIF = CStr(ConcatRange.Cells(1, 1))
End If
Exit Function
End If
' Copy the range defined by 1st Nor number of cells in 1st column of
' MatchRange to 2D 1-based 1-column Match Array.
vntM = MatchRange.Cells(1, 1).Resize(Nor)
' Copy the range defined by 1st Nor number of cells in 1st column of
' ConcatRange to 2D 1-based 1-column Concat Array.
vntC = ConcatRange.Cells(1, 1).Resize(Nor)
' Loop through elements (rows) of Match/Concat Arrays.
For i = 1 To Nor
' Check if current value in MatchArray is equal to MatchValue.
If vntM(i, 1) = MatchValue Then
' Write current value in ConcatArray to Concat String.
strC = CStr(vntC(i, 1))
' Check if Concat String is NOT "".
If strC <> "" Then
' Check if Result String is NOT "".
If strR <> "" Then
' Concatenate current value of Result String, Delimiter
' and Concat String, to Result String.
strR = strR & Delimiter & strC
Else
' Write Concat String to Result String (only once).
strR = strC
End If
End If
End If
Next
' Write Result String to CONCIF.
CONCIF = strR
End Function
add a comment |
Your Answer
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: "1"
;
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%2fstackoverflow.com%2fquestions%2f55291737%2fselect-values-next-to-matching-cells%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
2 Answers
2
active
oldest
votes
2 Answers
2
active
oldest
votes
active
oldest
votes
active
oldest
votes
In your google-sheets's D1 put this formula in and drag down.
=arrayformula(textjoin(" ", true, if(B:B=C1, A:A, "")))
add a comment |
In your google-sheets's D1 put this formula in and drag down.
=arrayformula(textjoin(" ", true, if(B:B=C1, A:A, "")))
add a comment |
In your google-sheets's D1 put this formula in and drag down.
=arrayformula(textjoin(" ", true, if(B:B=C1, A:A, "")))
In your google-sheets's D1 put this formula in and drag down.
=arrayformula(textjoin(" ", true, if(B:B=C1, A:A, "")))
answered Mar 22 at 2:48
user11217663user11217663
3894
3894
add a comment |
add a comment |
CONCIF (UDF)
In Excel
=CONCIF($B$1:$B$20,$C1,$A$1:$A$20)
In VBA
Option Explicit
Function CONCIF(MatchRange As Range, ByVal MatchValue As Variant, _
ConcatRange As Range, _
Optional ByVal Delimiter As String = " ") As String
Dim vntM As Variant ' Match Array
Dim vntC As Variant ' Concat Array
Dim Nor As Long ' Number of Rows
Dim i As Long ' Row Counter
Dim strC As String ' Concat String
Dim strR As String ' Result String
' Check number of rows in MatchRange is less than or equal to number
' of rows in Concat Range.
If MatchRange.Rows.Count <= ConcatRange.Rows.Count Then
' Write number of rows in MatchRange to Number of Rows.
Nor = MatchRange.Rows.Count
Else
' Write number of rows in ConcatRange to Number of Rows.
Nor = ConcatRange.Rows.Count
End If
' Check if Number of Rows is equal to 1, which would mean there
' can only be one match.
If Nor = 1 Then
' Check if the value in 1-cell MatchRange is equal to MatchValue.
If MatchRange.Cells(1, 1) = MatchValue Then
' Write value of 1-cell ConcatRange, converted to string, to CONCIF.
CONCIF = CStr(ConcatRange.Cells(1, 1))
End If
Exit Function
End If
' Copy the range defined by 1st Nor number of cells in 1st column of
' MatchRange to 2D 1-based 1-column Match Array.
vntM = MatchRange.Cells(1, 1).Resize(Nor)
' Copy the range defined by 1st Nor number of cells in 1st column of
' ConcatRange to 2D 1-based 1-column Concat Array.
vntC = ConcatRange.Cells(1, 1).Resize(Nor)
' Loop through elements (rows) of Match/Concat Arrays.
For i = 1 To Nor
' Check if current value in MatchArray is equal to MatchValue.
If vntM(i, 1) = MatchValue Then
' Write current value in ConcatArray to Concat String.
strC = CStr(vntC(i, 1))
' Check if Concat String is NOT "".
If strC <> "" Then
' Check if Result String is NOT "".
If strR <> "" Then
' Concatenate current value of Result String, Delimiter
' and Concat String, to Result String.
strR = strR & Delimiter & strC
Else
' Write Concat String to Result String (only once).
strR = strC
End If
End If
End If
Next
' Write Result String to CONCIF.
CONCIF = strR
End Function
add a comment |
CONCIF (UDF)
In Excel
=CONCIF($B$1:$B$20,$C1,$A$1:$A$20)
In VBA
Option Explicit
Function CONCIF(MatchRange As Range, ByVal MatchValue As Variant, _
ConcatRange As Range, _
Optional ByVal Delimiter As String = " ") As String
Dim vntM As Variant ' Match Array
Dim vntC As Variant ' Concat Array
Dim Nor As Long ' Number of Rows
Dim i As Long ' Row Counter
Dim strC As String ' Concat String
Dim strR As String ' Result String
' Check number of rows in MatchRange is less than or equal to number
' of rows in Concat Range.
If MatchRange.Rows.Count <= ConcatRange.Rows.Count Then
' Write number of rows in MatchRange to Number of Rows.
Nor = MatchRange.Rows.Count
Else
' Write number of rows in ConcatRange to Number of Rows.
Nor = ConcatRange.Rows.Count
End If
' Check if Number of Rows is equal to 1, which would mean there
' can only be one match.
If Nor = 1 Then
' Check if the value in 1-cell MatchRange is equal to MatchValue.
If MatchRange.Cells(1, 1) = MatchValue Then
' Write value of 1-cell ConcatRange, converted to string, to CONCIF.
CONCIF = CStr(ConcatRange.Cells(1, 1))
End If
Exit Function
End If
' Copy the range defined by 1st Nor number of cells in 1st column of
' MatchRange to 2D 1-based 1-column Match Array.
vntM = MatchRange.Cells(1, 1).Resize(Nor)
' Copy the range defined by 1st Nor number of cells in 1st column of
' ConcatRange to 2D 1-based 1-column Concat Array.
vntC = ConcatRange.Cells(1, 1).Resize(Nor)
' Loop through elements (rows) of Match/Concat Arrays.
For i = 1 To Nor
' Check if current value in MatchArray is equal to MatchValue.
If vntM(i, 1) = MatchValue Then
' Write current value in ConcatArray to Concat String.
strC = CStr(vntC(i, 1))
' Check if Concat String is NOT "".
If strC <> "" Then
' Check if Result String is NOT "".
If strR <> "" Then
' Concatenate current value of Result String, Delimiter
' and Concat String, to Result String.
strR = strR & Delimiter & strC
Else
' Write Concat String to Result String (only once).
strR = strC
End If
End If
End If
Next
' Write Result String to CONCIF.
CONCIF = strR
End Function
add a comment |
CONCIF (UDF)
In Excel
=CONCIF($B$1:$B$20,$C1,$A$1:$A$20)
In VBA
Option Explicit
Function CONCIF(MatchRange As Range, ByVal MatchValue As Variant, _
ConcatRange As Range, _
Optional ByVal Delimiter As String = " ") As String
Dim vntM As Variant ' Match Array
Dim vntC As Variant ' Concat Array
Dim Nor As Long ' Number of Rows
Dim i As Long ' Row Counter
Dim strC As String ' Concat String
Dim strR As String ' Result String
' Check number of rows in MatchRange is less than or equal to number
' of rows in Concat Range.
If MatchRange.Rows.Count <= ConcatRange.Rows.Count Then
' Write number of rows in MatchRange to Number of Rows.
Nor = MatchRange.Rows.Count
Else
' Write number of rows in ConcatRange to Number of Rows.
Nor = ConcatRange.Rows.Count
End If
' Check if Number of Rows is equal to 1, which would mean there
' can only be one match.
If Nor = 1 Then
' Check if the value in 1-cell MatchRange is equal to MatchValue.
If MatchRange.Cells(1, 1) = MatchValue Then
' Write value of 1-cell ConcatRange, converted to string, to CONCIF.
CONCIF = CStr(ConcatRange.Cells(1, 1))
End If
Exit Function
End If
' Copy the range defined by 1st Nor number of cells in 1st column of
' MatchRange to 2D 1-based 1-column Match Array.
vntM = MatchRange.Cells(1, 1).Resize(Nor)
' Copy the range defined by 1st Nor number of cells in 1st column of
' ConcatRange to 2D 1-based 1-column Concat Array.
vntC = ConcatRange.Cells(1, 1).Resize(Nor)
' Loop through elements (rows) of Match/Concat Arrays.
For i = 1 To Nor
' Check if current value in MatchArray is equal to MatchValue.
If vntM(i, 1) = MatchValue Then
' Write current value in ConcatArray to Concat String.
strC = CStr(vntC(i, 1))
' Check if Concat String is NOT "".
If strC <> "" Then
' Check if Result String is NOT "".
If strR <> "" Then
' Concatenate current value of Result String, Delimiter
' and Concat String, to Result String.
strR = strR & Delimiter & strC
Else
' Write Concat String to Result String (only once).
strR = strC
End If
End If
End If
Next
' Write Result String to CONCIF.
CONCIF = strR
End Function
CONCIF (UDF)
In Excel
=CONCIF($B$1:$B$20,$C1,$A$1:$A$20)
In VBA
Option Explicit
Function CONCIF(MatchRange As Range, ByVal MatchValue As Variant, _
ConcatRange As Range, _
Optional ByVal Delimiter As String = " ") As String
Dim vntM As Variant ' Match Array
Dim vntC As Variant ' Concat Array
Dim Nor As Long ' Number of Rows
Dim i As Long ' Row Counter
Dim strC As String ' Concat String
Dim strR As String ' Result String
' Check number of rows in MatchRange is less than or equal to number
' of rows in Concat Range.
If MatchRange.Rows.Count <= ConcatRange.Rows.Count Then
' Write number of rows in MatchRange to Number of Rows.
Nor = MatchRange.Rows.Count
Else
' Write number of rows in ConcatRange to Number of Rows.
Nor = ConcatRange.Rows.Count
End If
' Check if Number of Rows is equal to 1, which would mean there
' can only be one match.
If Nor = 1 Then
' Check if the value in 1-cell MatchRange is equal to MatchValue.
If MatchRange.Cells(1, 1) = MatchValue Then
' Write value of 1-cell ConcatRange, converted to string, to CONCIF.
CONCIF = CStr(ConcatRange.Cells(1, 1))
End If
Exit Function
End If
' Copy the range defined by 1st Nor number of cells in 1st column of
' MatchRange to 2D 1-based 1-column Match Array.
vntM = MatchRange.Cells(1, 1).Resize(Nor)
' Copy the range defined by 1st Nor number of cells in 1st column of
' ConcatRange to 2D 1-based 1-column Concat Array.
vntC = ConcatRange.Cells(1, 1).Resize(Nor)
' Loop through elements (rows) of Match/Concat Arrays.
For i = 1 To Nor
' Check if current value in MatchArray is equal to MatchValue.
If vntM(i, 1) = MatchValue Then
' Write current value in ConcatArray to Concat String.
strC = CStr(vntC(i, 1))
' Check if Concat String is NOT "".
If strC <> "" Then
' Check if Result String is NOT "".
If strR <> "" Then
' Concatenate current value of Result String, Delimiter
' and Concat String, to Result String.
strR = strR & Delimiter & strC
Else
' Write Concat String to Result String (only once).
strR = strC
End If
End If
End If
Next
' Write Result String to CONCIF.
CONCIF = strR
End Function
answered Mar 22 at 4:25
VBasic2008VBasic2008
3,5372517
3,5372517
add a comment |
add a comment |
Thanks for contributing an answer to Stack Overflow!
- 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%2fstackoverflow.com%2fquestions%2f55291737%2fselect-values-next-to-matching-cells%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
Please post an image of your data or a sample.
– Ricardo Diaz
Mar 22 at 1:48
@RicardoDiaz Added.
– Cody Harness
Mar 22 at 1:52
Could you please add a sample of how the result would look like?
– Ricardo Diaz
Mar 22 at 1:55
@RicardoDiaz My apologies, that should have been in the first image.
– Cody Harness
Mar 22 at 1:59
Are you trying to get index values from
Column A
for values likeBrian
.– Harun24HR
Mar 22 at 2:07