Copy formatting from Sheet to Sheet while using vlookup

muhleebbin

Active Member
Joined
Sep 30, 2017
Messages
252
Office Version
  1. 365
  2. 2019
  3. 2016
  4. 2013
  5. 2010
Platform
  1. Windows
  2. MacOS
  3. Mobile
  4. Web
I have the following data in one sheet (Attached Image) with a corresponding sheet that finds relevant data that i'm searching for.

Cell Formulas
RangeFormula
L1:R1L1=IF(ISBLANK('Toon Data'!J1),"",'Toon Data'!J1)
L2:R5L2=IF(ISNA(VLOOKUP($A2,'Toon Data'!$A$3:$CC$13,'Toon Data'!J$2,FALSE)),"",IF(ISBLANK(VLOOKUP($A2,'Toon Data'!$A$3:$CC$13,'Toon Data'!J$2,FALSE)),"",VLOOKUP($A2,'Toon Data'!$A$3:$CC$13,'Toon Data'!J$2,FALSE)))


Is there a way to bring in the source font formatting with this vlookup formula? Cell A1 is a selection menu of skills, so the data changes depending on if the character has that skill.
 

Attachments

  • Capture.JPG
    Capture.JPG
    34 KB · Views: 30
Last edited:

Excel Facts

Does the VLOOKUP table have to be sorted?
No! when you are using an exact match, the VLOOKUP table can be in any order. Best-selling items at the top is actually the best.
It is not posible to do that by formula
VBA can be used
see this recent thread (although OP @haitham1984 appears to have lost interest :confused: before getting to a solution)
 
Upvote 0
Thanks Yongle

I saw another thread about this and it seemed like the vba needed to be specific to each use case. I'll keep searching
 
Upvote 0
I'll keep searching
Searching further will confirm that this cannot be done by formula and that the required output can be achieved by VBA
- VBA requires method to find the source cells(s) and instruction to copy & paste value and format FROM source TO target cells(s)

it seemed like the vba needed to be specific to each use case
That is correct - each lookup is different

 
Upvote 0
Searching further will confirm that this cannot be done by formula and that the required output can be achieved by VBA

Sorry meant searching for a macro to assist in this
 
Upvote 0
Test as follows

Take a copy of the sheet containing the vlookup formula
Run macro from copied sheet
Check values in L2:R5

Let me know how you get on

Place code in a module like Module1
VBA Code:
Option Explicit

Sub LookupValueAndFormat()
    Dim cel As Range, DataRng As Range, source As Range
    Set DataRng = Sheets("Toon Data").Range("A3:A13")
    Application.ScreenUpdating = False
    For Each cel In Range("L2:R5")
        cel.ClearContents
        Set source = GetCellToCopy(cel, DataRng)
        If Not source Is Nothing Then
            source.Copy
            cel.PasteSpecial (xlPasteValues)
            cel.PasteSpecial (xlPasteFormats)
        End If
   Next cel
End Sub

Private Function GetCellToCopy(c As Range, look As Range) As Range
    Dim myRow As Long
    On Error Resume Next
    myRow = WorksheetFunction.Match(c.Offset(, 1 - c.Column), look, 0) + 2
    On Error GoTo 0
    Set GetCellToCopy = Nothing
    If myRow > 0 Then Set GetCellToCopy = look.Parent.Cells(myRow, c.Column - 2)
End Function
 
Upvote 0

Forum statistics

Threads
1,215,005
Messages
6,122,661
Members
449,091
Latest member
peppernaut

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