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.

[TABLE="width: 500"]
<tbody>[TR]
[TD]AMBIENRX[/TD]
[TD]Medication[/TD]
[/TR]
[TR]
[TD]AMOXICILLIN RX PHARM[/TD]
[TD]Medication[/TD]
[/TR]
[TR]
[TD]SURGICAL PATH[/TD]
[TD]Pathology Report[/TD]
[/TR]
[TR]
[TD]SURGICAL PATH 7/11[/TD]
[TD]Pathology Report[/TD]
[/TR]
[TR]
[TD]PATIENT INTAKE[/TD]
[TD]Past Record[/TD]
[/TR]
[TR]
[TD]PAST RECORD 2/13[/TD]
[TD]Past Record[/TD]
[/TR]
[TR]
[TD]OP REPORT[/TD]
[TD]OP Report[/TD]
[/TR]
[TR]
[TD]CT CYSTOGRAM 3/05/13[/TD]
[TD]X-Ray[/TD]
[/TR]
</tbody>[/TABLE]

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

Thanks a bunch
 

Excel Facts

How to calculate loan payments in Excel?
Use the PMT function: =PMT(5%/12,60,-25000) is for a $25,000 loan, 5% annual interest, 60 month loan.
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
AMBIENRXMedication
AMOXICILLIN RX PHARMMedication
SURGICAL PATHPathology Report
SURGICAL PATH 7/11Pathology Report
PATIENT INTAKE
PAST RECORD 2/13Past Record
OP REPORTOP Report
CT CYSTOGRAM 3/05/13

<tbody>
[TD="align: center"]1[/TD]

[TD="align: center"]2[/TD]

[TD="align: center"]3[/TD]

[TD="align: center"]4[/TD]

[TD="align: center"]5[/TD]

[TD="align: center"]6[/TD]

[TD="align: center"]7[/TD]

[TD="align: center"]8[/TD]

</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,223,231
Messages
6,170,884
Members
452,364
Latest member
springate

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