'apply formula to multiple rows of a column with caxlsx gem

I have a selec from row E5 to E2000, the code is as follows:

sheet.add_data_validation("E5:E2000", {
    :type => :list,
    :formula1 => "list_of_products!A$2:A$55",
    :showDropDown => false,
    :showErrorMessage => true,
    :errorTitle => '',
    :error => 'Please use the dropdown selector to choose the value',
    :errorStyle => :stop,
    :showInputMessage => true,
    :prompt => 'Choose the value from the dropdown'
})

and I have this formula:

=IFERROR(VLOOKUP(E5,list_of_products!A2:B55,2,0),#{'"n/a"'})

how can I apply this last formula in the same way as the select? affecting the column from F5 to F2000. the formula what it does is to take a secondary field of the select that is in the sheet "list_of_products".

the formula should change the =IFERROR(VLOOKUP(E5 depending on which row it is in.



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source