Take all the values with a specific text in the next cell?

Uumas

New Member
Joined
Oct 8, 2017
Messages
3
ABC
1OriginalTypeResult
267a98
398a87
4238b
59a
698c
745b
887c
99a

<tbody>
</tbody>

I want to have only values of type c end up in the results column. I know I could simply use an if statement, but that'd leave empty cells where it isn't type c and I don't want that. How should I do this?
 

Excel Facts

Whats the difference between CONCAT and CONCATENATE?
The newer CONCAT function can reference a range of cells. =CONCATENATE(A1,A2,A3,A4,A5) becomes =CONCAT(A1:A5)
Here is a Vba solution:

Code:
Sub Look_For_C()
'Modified  10/5/2018  7:48:35 PM  EDT
Application.ScreenUpdating = False
Dim Lastrow As Long
Lastrow = Cells(Rows.Count, "B").End(xlUp).Row
Dim x As Long
Dim r As Range
x = 2
    For Each r In Range("B2:B" & Lastrow)
        If r.Value = "c" Then Cells(x, "C").Value = r.Offset(, -1).Value: x = x + 1
    Next
Application.ScreenUpdating = True
End Sub
 
Upvote 0
Formula options. Note that I have changed your sample data slightly.

If you don't care what order the results come in, C2 copied down.
If you want to preserve the original order, D2.

Excel Workbook
ABCD
1OriginalTypeResult
267c9867
398a8798
4238b6787
59a
698c
745b
887c
99a
Type c
 
Upvote 0

Forum statistics

Threads
1,215,767
Messages
6,126,767
Members
449,336
Latest member
p17tootie

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