View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Tom Hutchins Tom Hutchins is offline
external usenet poster
 
Posts: 1,069
Default vlookup using contents of clipboard?

You can do this easily without a macro...

In your sample worksheet, enter this formula in C9 and copy down:
=SUMPRODUCT(--($A$2:$A$4=A9),--($B$2:$B$4=B9),$C$2:$C$4)

If you don't want to see the zeros, you can either hide them or use the
following formula instead:
=IF(SUMPRODUCT(--($A$2:$A$4=A9),--($B$2:$B$4=B9),$C$2:$C$4)=0,"",SUMPRODUCT(--($A$2:$A$4=A9),--($B$2:$B$4=B9),$C$2:$C$4))

If you are unfamiliar with SUMPRODUCT, here is a good introduction:
http://www.xldynamic.com/source/xld.SUMPRODUCT.html

Hope this helps,

Hutch

" wrote:

Here's the spreadsheet I'm working on:
http://www.myfootsmells.com/excel/copypaste.xls

I want to copy from A2:C4 and then put my cursor in C9 do a paste and
it'll fill in the hours accordingly. Possible? It doesn't need to be
a paste, I'd be find putting my cursor in C9 and pressing a button on
the page.

Thanks,

Michael