Help creating a column with values from row next to specific text in row

rdog6

New Member
Joined
Mar 21, 2022
Messages
2
Office Version
  1. 365
Platform
  1. MacOS
Hello

I have a large dataframe and I want to create a new column with gives me the value of cell on the right side of a cell that contains a specific text.

The table below is an example of my table. I want to fill the last column (Caffeine) with the values that are written on the right side of the word "caffeine" anywhere in the row. The problem is that caffeine can be written in various places (here in columns concurrent medication 1 AND 2). I have tried it with index and math, but I cannot get it to work.



does anyone know a solution for this?

PATIENT ID​
PATIENT STATUS​
WEIGHT​
DATE OF TREATMENT​
PATIENT TREATMENT NUMBER​
RESTIMULATION​
CONCURRENT MEDICATION_1​
CONCURRENT MEDICATION_1 DOSE (MG)​
CONCURRENT MEDICATION_2​
CONCURRENT MEDICATION_2 DOSE (MG)​
Caffeine
875452​
80​
02.03.22 08:41​
33​
No​
Caffeine​
200​
875452​
80​
09.02.22 11:41​
32​
No​
Propofol​
20​
Caffeine200
 

Excel Facts

Does the VLOOKUP table have to be sorted?
No! when you are using an exact match, the VLOOKUP table can be in any order. Best-selling items at the top is actually the best.
Hi,

Here's one way:

Book3.xlsx
ABCDEFGHIJK
1PATIENT IDPATIENT STATUSWEIGHTDATE OF TREATMENTPATIENT TREATMENT NUMBERRESTIMULATIONCONCURRENT MEDICATION_1CONCURRENT MEDICATION_1 DOSE (MG)CONCURRENT MEDICATION_2CONCURRENT MEDICATION_2 DOSE (MG)Caffeine
28754528002.03.22 08:4133NoCaffeine200200
38754528009.02.22 11:4132NoPropofol20Caffeine200200
Sheet1054
Cell Formulas
RangeFormula
K2:K3K2=INDEX(A2:J2,MATCH(K$1,A2:J2,0)+1)
 
Upvote 0
Hi,

Here's one way:

Book3.xlsx
ABCDEFGHIJK
1PATIENT IDPATIENT STATUSWEIGHTDATE OF TREATMENTPATIENT TREATMENT NUMBERRESTIMULATIONCONCURRENT MEDICATION_1CONCURRENT MEDICATION_1 DOSE (MG)CONCURRENT MEDICATION_2CONCURRENT MEDICATION_2 DOSE (MG)Caffeine
28754528002.03.22 08:4133NoCaffeine200200
38754528009.02.22 11:4132NoPropofol20Caffeine200200
Sheet1054
Cell Formulas
RangeFormula
K2:K3K2=INDEX(A2:J2,MATCH(K$1,A2:J2,0)+1)
HI, thank you so much for your quick response, that worked perfekt!
 
Upvote 0

Forum statistics

Threads
1,214,642
Messages
6,120,700
Members
448,979
Latest member
DET4492

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