Adding Suffix to a cell based on value of a another Cell

aaronr

New Member
Joined
Jul 8, 2010
Messages
34
i'm dealing with columns A and F. I need to add letter A to end all values in Columns A if Column F has Level or Roof in columns F.

Data before modified
Column A Column F
[TABLE="width: 219"]
<colgroup><col><col></colgroup><tbody>[TR]
[TD]P1.00[/TD]
[TD]LEVEL [/TD]
[/TR]
[TR]
[TD]P1.09[/TD]
[TD]LEVEL [/TD]
[/TR]
[TR]
[TD]P1.10[/TD]
[TD]LEVEL[/TD]
[/TR]
[TR]
[TD]M1.11[/TD]
[TD]ROOF PLAN[/TD]
[/TR]
[TR]
[TD]M1.12[/TD]
[TD]ROOF PLAN LOW[/TD]
[/TR]
[TR]
[TD]P2.00[/TD]
[TD][/TD]
[/TR]
[TR]
[TD]P4.00[/TD]
[TD][/TD]
[/TR]
[TR]
[TD]P5.00[/TD]
[TD][/TD]
[/TR]
[TR]
[TD]P6.00[/TD]
[TD][/TD]
[/TR]
[TR]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD]Data after modified[/TD]
[TD][/TD]
[/TR]
</tbody>[/TABLE]
Column A Column F
[TABLE="width: 219"]
<colgroup><col><col></colgroup><tbody>[TR]
[TD]P1.00A[/TD]
[TD]LEVEL [/TD]
[/TR]
[TR]
[TD]P1.09A[/TD]
[TD]LEVEL [/TD]
[/TR]
[TR]
[TD]P1.10A[/TD]
[TD]LEVEL[/TD]
[/TR]
[TR]
[TD]M1.11A[/TD]
[TD]ROOF PLAN[/TD]
[/TR]
[TR]
[TD]M1.12A[/TD]
[TD]ROOF PLAN LOW[/TD]
[/TR]
[TR]
[TD]P2.00[/TD]
[TD][/TD]
[/TR]
[TR]
[TD]P4.00[/TD]
[TD][/TD]
[/TR]
[TR]
[TD]P5.00[/TD]
[TD][/TD]
[/TR]
[TR]
[TD]P6.00[/TD]
[/TR]
</tbody>[/TABLE]
 

Excel Facts

Test for Multiple Conditions in IF?
Use AND(test, test, test, test) or OR(test, test, test, ...) as the logical_test argument of IF.
If you want them modified at the same locations, you will need a macro.
You ok with that ?
 
Upvote 0
Try
Code:
Option Compare Text
Sub MM1()
Dim lr As Long, r As Long
lr = Cells(Rows.Count, "A").End(xlUp).Row
For r = lr To 1 Step -1
    If InStr(Range("F" & r), "Level") Or InStr(Range("F" & r), "roof") Then
        Range("A" & r).Value = Range("A" & r).Value & "A"
    End If
Next r
End Sub
 
Upvote 0
Here is another macro that should also work...
Code:
[table="width: 500"]
[tr]
	[td]Sub AddSuffixA()
  Dim LastRow As Long
  LastRow = Cells(Rows.Count, "A").End(xlUp).Row
  Range("A1:A" & LastRow) = Evaluate(Replace("IF(ISNUMBER(SEARCH(""LEVEL"",F1:F#))+ISNUMBER(SEARCH(""ROOF"",F1:F#)),A1:A#&""A"",A1:A#)", "#", LastRow))
End Sub[/td]
[/tr]
[/table]
 
Last edited:
Upvote 0

Forum statistics

Threads
1,223,893
Messages
6,175,240
Members
452,621
Latest member
Laura_PinksBTHFT

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