Thread: lookup format
View Single Post
  #2  
Old October 2nd, 2008, 09:47 PM posted to microsoft.public.excel.misc
Thomas [PBD]
external usenet poster
 
Posts: 137
Default lookup format

Rach,

The best that I could dally up was the return the number formatting of a
VLookup, not necessarily the borders/fill/text color.

This would require you to add a User Defined Function to your document.
Press Alt+F11InsertModule. In the module add:

Function GetFormat(Cell as Range) as String
GetFormat = cell.NumberFormat
End Function

and for your Vlookup, you will need to add:

=TEXT(VLOOKUP(Cell,Array,Column,T/F),GetFormat(Cell))

So, if B1 is the value you wish to return, from array A1:B4, lookup on C1,
then:

=TEXT(VLOOKUP(C1,$A$1:$B$4,2,FALSE),GetFormat(B1))

--
--Thomas [PBD]
Working hard to make working easy.


"Rach" wrote:

Hi

I'm doing a vlookup but i also want to maintain the formatting of the cell
that has the data that im looking up e.g. highlighted in blue.

Is there a way to do this?