Multiple cells into 1 issue

Newbienew

Active Member
Joined
Mar 17, 2017
Messages
376
Office Version
  1. 2016
Platform
  1. Windows
I am attempting to add 4 cells into 1 with "+" in between the first three results and "=" at the end.
B6C6D6E6F6G6H6I6J6M6 (FORMULA)
VEARLODH3VE+AR+LO+DH=3
ARHEHU5AR+HE+HU=5
HEIU9HE+IU=9

Cell M7 is where I started my formula. If all 4 cells are filled in the formula works great but anything less my formula bombs. The + and = are always left behind and looks like the following.
AR+HE+HU+0=5
HE+IU+0+0=9
or if all other cells are blank
+++=

Being each cell can vary in data, the formula would need to be dynamic in order to display what is in each cell with the right characters needed.


Current formula in use =IF(COUNTA(H7),B7&"+"&D7&"+"&F7&"+"&H7,IF(COUNTA(F7),B7&"+"&D7&"+"&F7,IF(COUNTA(F7),B7&"+&D10","")))&"="&K7

I even attempted to use concentrate, but I get the same results

What set of formulas will i need to make this happen.
 
A shorter version of above code.
VBA Code:
Function TEXTJOIN(rng As Range, Delim As String)
            Dim store As Long, rng2 As Range, V, S
            Dim i As Integer
            
            If rng.Rows.Count = 1 Then
            ReDim V(1 To rng.Columns.Count)
            Else: ReDim V(1 To rng.Rows.Count)
            End If
            
            For Each rng2 In rng
                    If rng2 <> "" Then
                      i = i + 1
                      V(i) = rng2.Value
                    End If
            Next rng2
            
            For i = LBound(V) To UBound(V)
                If V(i) <> "" Then
                    store = store + 1
                End If
            Next i
            
            ReDim S(1 To store)
            
            store = 0
            For i = LBound(V) To UBound(V)
                If V(i) <> "" Then
                    store = store + 1
                    S(store) = V(i)
                 End If
            Next i
            
            TEXTJOIN = Join(S, Delim)
            
End Function
 
Upvote 0

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)
I love this and will us it for my personal version, but this is going to have to be a non-macro. We use an in house online share folder. Marcos are disabled and will not work. I thought I could get a way with it doing something else.
 
Upvote 0
Replying back to this thread as I have been fiddling with this for some time now and I had part of it figured out but not the rest. I am not sure what to do or what I am doing wrong.

My first result needs to be the letters and + sign with the sum as displayed in the first red cell. But depending on what is chosen I get VE+VE+=145 or VE+VE+0+0=
The same thing goes for the second red cell with the numbers.

I believe that this is due to the these cells having formula's in them

If the source cell returns VE 34 GS 56 MK 34 I need the first read cell to be VE+GS+MK= but if the source cell changes and it becomes VE 52 GS 75 It just needs to display that and not VE+GS+0+0= or VE+GS+0= it just needs to be VE+GS

This goes for the second red cell with the numbers.

It work PERFECT when all cells are filled. But when not I get this situation I have. I have attached a workbook with the unlocked cells needed. I have added 3 selections that duplicate the issue at hand.

Please help Character Display issue workbook
 
Upvote 0
Any help with for 2016 excel version formula would be greatly appreciated
 
Upvote 0

Forum statistics

Threads
1,215,046
Messages
6,122,852
Members
449,096
Latest member
Erald

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