vba - How to dynamically change the MS excel 2016 vlookup value by clicking on different cells? -
based on tables in ms excel 2016 spreadsheet, working sum
of vlookup
array function in order built sum of 2 columns given lookup value:
=sum(vlookup(lookup_value, lookup_range, {2,3,4}, false))
the tables typically this:
lookup_value january february march april 8/15/2020 $1.66 $1.40 $1.05 $103.00 2/15/2021 $1.50 $1.97 $0.47 $99.51 8/15/2021 $1.50 $1.96 $0.46 $99.05 2/15/2022 $1.50 $1.95 $0.45 $98.60 8/15/2022 $1.50 $1.94 $0.44 $98.15 2/15/2023 $1.50 $1.93 $0.43 $97.72 8/15/2023 $1.50 $1.93 $0.43 $97.30
for example, result of
=sum(vlookup( 8/15/2020, $a$1:$g$5, {january, march}, false))
is $1.66 + $ 1.05 = $ 2.71
is there way dynamically change the lookup value clicking on different cells? need tool produces vlookup sum different date lookup values, defined when click on them.
how dynamically change vlookup value based on cursor operations?
could rebuild vlookup formula each time user double-clicks, using workbook event monitor clicks?
private sub workbook_sheetbeforedoubleclick(byval sh object, byval target range, cancel boolean) private sub workbook_sheetselectionchange(byval sh object, byval target range)
use these in code 'thisworkbook' object. rebuild vlookup using activecell.address
or similar. add vlookup each time user double-clicks, , include "clear" button resetting vlookup.
Comments
Post a Comment