Determining best independent variables through factor analysis

#1
Hi everyone,

I have a dependent variable and 18 independent variables. I remember from an applied statistics class I took, that there is a way to determine which independent variables are most important and sometimes even combining some of them that are relatively similar.

My end goal would be to determine factors (weights) to apply to the independent variables, which I would be able to derive from my data samples. How can I determine the factors? Can I use excel, I also have the software R.

Thank you in advance for any help!!! Below is a more detailed explanation of the problem at hand.

I have collected the return on 650+ stocks (a 1 year holding period), in addition I have 18 independent variables associated with the 650+ stocks from a year ago. My goal is to use those variables to screen stocks, the screening tool I use performs multi-factor analysis, but I have to input the factors or weights for each of the 18 variables, I believe this can be derived through factor analysis based on the sample data I have captured.