A Microsoft Office (Excel, Word) forum. OfficeFrustration

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

Go Back   Home » OfficeFrustration forum » Microsoft Excel » General Discussion
Site Map Home Register Authors List Search Today's Posts Mark Forums Read  

lookup format



 
 
Thread Tools Display Modes
  #1  
Old October 2nd, 2008, 08:51 PM posted to microsoft.public.excel.misc
Rach
external usenet poster
 
Posts: 17
Default lookup format

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?
  #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?

 




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Forum Jump


All times are GMT +1. The time now is 11:00 AM.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 OfficeFrustration.
The comments are property of their posters.