Copy formatting in VLOOKUP

davehnj

Board Regular
Joined
Jul 2, 2010
Messages
56
When doing a vlookup of an existing table, is there anyway to bring the formatting along with the data? For instance, if a cell in the table is red, can this format setting be brought into the cell from which the lookup is started? VBA solutions would be great too.
 

Excel Facts

How can you turn a range sideways?
Copy the range. Select a blank cell. Right-click, Paste Special, then choose Transpose.
Welcome to the MrExcel board!

General cell formatting cannot be applied by a formula, so VLOOKUP cannot do this for you. It would need to be VBA. If you provided more details about where your current formula(s) is/are, what the formula is (so we know the type of lookup, the value being looked up and the range being looked in) etc then somebody might be able to provide some help with the vba.
 
Upvote 0
Peter, thank you so much for your quick reply. The table is in the same sheet and has item descriptions that are formatted in red or green as needed. but when they are "looked up" and brought to the vlookup cell, the formatting is gone! Only the formatting in the vlookup cell is active. If the description in the lookup table was red, it is not when brought to the vlookup cell. As you described, only the text is brough over, not the formatting. If possible, could the vlookup provide the cell address where the description can be found as a hyperlink so the user can directly go to the description in the original cell (in the lookup table)? For instance, instead of bringing back the esults of the vlookup, is it possible to use index and match to brong back the cell address and wrap that in a hyperlink so the user can immediately jump to description with the formatting? Sorry for rambling on.
 
Upvote 0
Sorry for the slow response but see if this sort of thing is any use. Hyperlinks are not a strong point of mine so I don't know if this is the best way but I think it does what you want. If cell A2 is changed to, say, 'b' then cell B2 will display '2' and will be hyperlinked to cell H3.

My worbook that contains this sheet is called 'Hyperlink Test.xlsx' so you would need to change that and the sheet name to match your names.

Excel Workbook
ABCDEFGHI
1H1H2H1H2
2c3a1
3b2
4c3
5d4
6
Sheet 4
 
Upvote 0
Thanks again Peter for trying to work on my problem. I just cannot seem to get this to work. I keep getting a message from Excel when I try to jump to the hyperlink - "Bad reference". I know that I must be doing something wrong, but I cannot surmise what that could be! I'll keep trying. Thanks.
 
Upvote 0
Thanks again Peter for trying to work on my problem. I just cannot seem to get this to work. I keep getting a message from Excel when I try to jump to the hyperlink - "Bad reference". I know that I must be doing something wrong, but I cannot surmise what that could be! I'll keep trying. Thanks.
For a start, try setting up a new workbook to replicate what I have done. That is ..

- call your workbook 'Hyperlink Test.xlsx' (Unless you are using a pre-2007 Excel version in which case you would name it 'Hyperlink Test.xls'. BTW, what version are you using?)

- name the sheet 'Sheet 4'

- set up the data and formula just as I have (adjust the formula if your workbook is an '.xls' instead of '.xlsx)

Does that work?

If so, then we have to start working on what is different between your workbook and mine to see if we can adapt to make it work for you.
 
Upvote 0

Forum statistics

Threads
1,224,590
Messages
6,179,749
Members
452,940
Latest member
rootytrip

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top