I am working with lots of laboratory test results that are presented within one column in excel however the results come in different units from different labs so I need to convert some of the data so that all of the lab data is in the same units.
I have created a macro that looks up the lab data that I want to change and will convert the data however some of the results are presented as <0.07 etc. however the macro will not recognise and convert anything with < at the start of the number.
Can anyone suggest a way that I can amend the following macro to also convert lab results that contain < at the start?
Sub CONVERT_UNITS()
'
' CONVERT_UNITS Macro
'
'
ActiveCell.FormulaR1C1 = _
"=IF(RC12=""ug/kg"",RC11/1000,IF(RC12=""mg/l"",RC11*1000,RC11))"
Range("M2").Select
Selection.AutoFill Destination:=Range("M2:M" & Range("L" & Rows.Count).End(xlUp).Row)
Range(Range("M2"), Range("M2").End(xlDown)).Select
End Sub
For reference my lab data is contained in column K with the units presented in column L. I want the converted lab results to be put in column M (see example data below). I am only converting results that are in ug/kg (divide result by 1000) and mg/l (multiply result by 1000), all the other results will remain as they are.