Combining text from multiple cells

M

mgerken79

Help please. I'm trying to combine text from multiple cells using the
following formula.
=B3&" / "&C3&" / "&D3&" / "&E3&" / "&F3&" / "&G3

Column I is where I am combining what is in these cells.

The above cells contain formulas which I am using to QA certain data. They
can return things like "Low Yield", "High Yield", and "Q" if the data meets
the right conditions. I need the individual cells to return each of these
possibilities, which include spaces, but I only want column I to combine the
ones that are NOT "Q".

Please let me know if you need more info to help. Thanks so much.
 
M

mgerken79

Actually I don't want them to combine the blank cells either. So just ones
that contain "High Yield" or "Low Yield". Is that possible?
 
T

Tom Hutchins

I'm not sure exactly what you want to see in your output. Try these:

=SUBSTITUTE(SUBSTITUTE(B3&" / "&C3&" / "&D3&" / "&E3&" / "&F3&" / "&G3,"/
/","/ /")," Q "," ")

=SUBSTITUTE(SUBSTITUTE(B3&" / "&C3&" / "&D3&" / "&E3&" / "&F3&" / "&G3,"/ Q
/","/"),"/ /","/")

Those are two separate formulas. They may have wrapped from being posted on
the forum. Does one of them do what you want?

Hope this helps,

Hutch
 
M

mgerken79

Tom

This first equation is so very close. Thank you for the help. I'm sure I
just want my cake and to eat it too, but this first equation changes the "Q"
into blanks and I want it to return nothing. Is that possible?

Thanks for the help.

Mark
 
M

mgerken79

Nevermind Tom. Modified your formula and got it!! :) Thanks alot. I love it
when I get my cake and eat it too.
 
D

Don Guillett

Option Explicit
Sub stripqSAS()
Dim h As Long
Dim i As Integer
Dim ms As String

For h = 1 To Cells(Rows.Count, "b").End(xlUp).Row
ms = ""
For i = 2 To 7 'col B-G
If Cells(h, i) <> "q" And Cells(h, i) <> "" Then
ms = ms & Cells(h, i) & "/"
End If
Next i
Cells(h, "i") = Left(ms, Len(ms) - 1)
Next h
End Sub
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top