Combining Cells

fedas18

Board Regular
Joined
Jan 21, 2010
Messages
81
I would like to combine 3 cells into 1.

A1 B1 C1 into D1

A1 B1 C1 D1

NR Aaa AAA Aaa/AAA

Ideally the formula would ignore whenever it says NR. However I am not sure if that is possible.

Example:

AA- NR AA- AA-/AA-

AAA Aaa NR AAA/Aaa



Thanks
 

Excel Facts

Excel Wisdom
Using a mouse in Excel is the work equivalent of wearing a lanyard when you first get to college
=IF(AND(A1<>"nr",B1<>"nr",C1<>"nr"),CONCATENATE(A1,"/",B1,"/",C1)),IF(AND(A1="nr",B1<>"nr",C1<>"nr"),CONCATENATE(B1,"/",C1)),IF(AND(A1<>"nr",B1="nr",C1<>"nr"),CONCATENATE(A1,"/",C1)),IF(AND(A1<>"nr",B1<>"nr",C1="nr"),CONCATENATE(A1,"/",B1),"")
 
Last edited:
Upvote 0
Says You've entered too many arguments for this function.

Any way around that?


That means the parenthesis are messed up, i just edited the formula see if that works for you. For some reason, my excel is not functioning (i need to reset my comp) so I haven't tested this formula, but I believe the logic is correct.
 
Upvote 0
Says You've entered too many arguments for this function.

Any way around that?



Here it is: I just verified it!

=IF(AND(A1<>"nr",B1<>"nr",C1<>"nr"),CONCATENATE(A1,"/",B1,"/",C1),IF(AND(A1="nr",B1<>"nr",C1<>"nr"),CONCATENATE(B1,"/",C1),IF(AND(A1<>"nr",B1="nr",C1<>"nr"),CONCATENATE(A1,"/",C1),IF(AND(A1<>"nr",B1<>"nr",C1="nr"),CONCATENATE(A1,"/",B1),""))))
 
Upvote 0
Excel Workbook
ABCD
1NRAaaAAAAaa/AAA
Sheet1


UDF:
Code:
Function Combine_NR(r As Range, Optional d As String)

Application.Volatile

Dim x As Range
Dim s As String

For Each x In r
    If x <> "NR" Then
        s = s & x
        If d <> "" Then s = s & d
    End If
Next x

If d <> "" Then
    Combine_NR = Left(s, Len(s) - 1)
Else: Combine_NR = s
End If


End Function
 
Upvote 0

Forum statistics

Threads
1,224,583
Messages
6,179,682
Members
452,937
Latest member
Bhg1984

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