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.
I want to fill a new last column (I will name the column Caffeine) with the values that are written on the right side of the word "caffeine" anywhere in the row. So for example if Caffeine is written in am row in column 4, it will give me the value of column 5 in the same row and if it is written in column 7 it will give me the answer in column 8. If Caffeine is not written in the this row, it will give me NA
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?