Trying to use specific text strings in A:A to populate something else in B:B

urodoc

New Member
Joined
Oct 8, 2013
Messages
2
Hi. I've tried using VLOOKUP, but I guess that didn't work because I need full values and not parts.

Column A has text that I need to transcribe into Column B as a specific Category. For instance, for every time "RX" appears in column A (not standalone necessarily) I need Column B to write "Medicine." For every time "Operative" or "OP" appears in Column A, I need "OP Report" to show up in column B. Here's a small example of what my A and B should look like. As it stands, A is full and B is completely empty.

AMBIENRXMedication
AMOXICILLIN RX PHARMMedication
SURGICAL PATHPathology Report
SURGICAL PATH 7/11Pathology Report
PATIENT INTAKEPast Record
PAST RECORD 2/13Past Record
OP REPORTOP Report
CT CYSTOGRAM 3/05/13X-Ray

<tbody>
</tbody>

Any help is greatly appreciated, including letting me know that I'm asking for the moon!

Thanks a bunch
 

Excel Facts

Spell Check in Excel
Press F7 to start spell check in Excel. Be careful, by default, Excel does not check Capitalized Werds (whoops)
Hi and welcome to the Board
I'm guessing this is only part of a bigger question....:biggrin:

So would a VBA soultion be suitable

Code:
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("A" & r).Value, "RX") Then
        Range("B" & r).Value = "Medicine"
    ElseIf InStr(Range("A" & r).Value, "OP") Then
        Range("B" & r).Value = "OP Report"
    End If
Next r
End Sub
 
Upvote 0
AB
1AMBIENRXMedication
2AMOXICILLIN RX PHARMMedication
3SURGICAL PATHPathology Report
4SURGICAL PATH 7/11Pathology Report
5PATIENT INTAKE
6PAST RECORD 2/13Past Record
7OP REPORTOP Report
8CT CYSTOGRAM 3/05/13

<tbody>
</tbody>

Formula: =IF(ISNUMBER(SEARCH("RX",A1)),"Medication",IF(OR(ISNUMBER(SEARCH({"Operative";"Op"},A1))),"OP Report",IF(ISNUMBER(SEARCH("Path",A1)),"Pathology Report",IF(ISNUMBER(SEARCH("Past",A1)),"Past Record",""))))

I dont know how to find "Past Record" from Patient Intake or "X-Ray" from CT CYSTOGRAM 3/05/13. If you have a criteria for that, I can add it to the formula.
 
Upvote 0

Forum statistics

Threads
1,215,348
Messages
6,124,425
Members
449,157
Latest member
mytux

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