Copy rows from one sheet to another under certain conditions

Brass Contributor

I have a spreadsheet can do this with excel formulas, but its really, really clunky. I imagine that VBA can do this easily, but I have no idea how to do VBA. 

What I need:

Move a row of data from the "Raw Data" sheet to the "Undiluted" sheet if:

---the "Sample Type" column says "Unknown" or "Quality Control"

AND

......the "Dilution Factor" column says 1. 

also:

if the dilution factor column says anything other than 1 (i.e. >1) then the data goes to the "Diluted" tab instead. 

 

Basically: Unknown and Quality Control samples with Dilution Factor = 1 go to "Undiluted Tab" and if they are >1 go to the "Diluted Tab"

 

Also, its not guaranteed that the "Unknown" or "Quality Control" columns will be in the same location with every data file that I work with.....so there will have to be a line that finds the column on its own each time.

 

[Also, it'd be nice if the headers would move to the undiluted and diluted sheets as well ;) ]

 

Thanks,


Greg

 

1 Reply

@gms4b 

Hi Greg,

 

Do you consider Power Query as an options to select raw data?