Welcome to the Excel Forum

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.

Please Register to Remove these Ads

Please Register to Remove these Ads



Reply
  #1  
Old 11-11-2009, 03:09 PM
dcw0405 dcw0405 is offline
Registered User
 
Join Date: 02 Apr 2009
Location: Raleigh, NC
MS Office Version:Excel 2003
Posts: 5
dcw0405 is becoming part of the community
Red face Lookup

Please Register to Remove these Ads

Hey Guys,

So I'm attaching a sample of what I'm wanting to do. I'm needing a little bit of help.
What I'm trying to do is find all the accounts that say "PayPal" and put them into another column. Then the corresponding values that go next to it, I want those in the table as well..

If you look at my spreadsheet, it makes more sense.

Thanks for all your help!
Attached Files
File Type: xls sample.xls (14.5 KB, 1 views)
Reply With Quote
  #2  
Old 11-11-2009, 03:52 PM
JP Romano's Avatar
JP Romano JP Romano is offline
Forum Contributor
 
Join Date: 09 Oct 2008
Location: Princeton, NJ
MS Office Version:2007 at work. Abacus at home
Posts: 165
JP Romano has been very helpful
Re: Lookup Formula Help - Possible VBA?

Not elegant, but it works for me...

This assumes your data starts in A2 and will put your results in columns F-H.

Code:
Dim lastrow As Integer
lastrow = Range("a65536").End(xlUp).Row

Range("A2").Select
Do Until ActiveCell.Row = lastrow
    If ActiveCell.Value = "PayPal" Then
        Row = ActiveCell.Row
        Range(ActiveCell.Offset(0, 2), ActiveCell.Offset(0, 3)).Copy
        Range("G65536").End(xlUp).Offset(1, 0).Select
        ActiveCell.Offset(0, -1).Value = "PayPal"
        ActiveCell.PasteSpecial
        Range("A" & Row).Select

    End If
    ActiveCell.Offset(1, 0).Select
    Loop

Range("F2").Select
    Range(Selection, Selection.End(xlDown)).Select
    Range(Selection, Selection.End(xlToRight)).Select
    With Selection.Borders(xlEdgeLeft)
        .LineStyle = xlContinuous
        .Weight = xlThin
    End With
    With Selection.Borders(xlEdgeTop)
        .LineStyle = xlContinuous
       .Weight = xlThin
    End With
    With Selection.Borders(xlEdgeBottom)
        .LineStyle = xlContinuous
        .Weight = xlThin
    End With
    With Selection.Borders(xlEdgeRight)
        .LineStyle = xlContinuous
        .Weight = xlThin
    End With
    With Selection.Borders(xlInsideVertical)
        .LineStyle = xlContinuous
        .Weight = xlThin
    End With
    With Selection.Borders(xlInsideHorizontal)
        .LineStyle = xlContinuous
        .Weight = xlThin
    End With
    Range("F2").Select
Let me know if that's what you're after!
__________________
Who believes in telekinesis... raise my hand!

Last edited by JP Romano; 11-11-2009 at 03:59 PM.
Reply With Quote
  #3  
Old 11-11-2009, 04:07 PM
dcw0405 dcw0405 is offline
Registered User
 
Join Date: 02 Apr 2009
Location: Raleigh, NC
MS Office Version:Excel 2003
Posts: 5
dcw0405 is becoming part of the community
Re: Lookup Formula Help - Possible VBA?

Thanks! Is that a VBA or Macro? I'm not sure where to input that on the spreadsheet..
Reply With Quote
  #4  
Old 11-11-2009, 04:12 PM
JP Romano's Avatar
JP Romano JP Romano is offline
Forum Contributor
 
Join Date: 09 Oct 2008
Location: Princeton, NJ
MS Office Version:2007 at work. Abacus at home
Posts: 165
JP Romano has been very helpful
Re: Lookup

Sorry...my bad. I'm using Excel 2007 and always have problems executing macros from downloaded websites. Do this...
1) Alt + F11 to open the VBA editor
2) Right click on the name of your file and select INSERT / MODULE
3) At the top of the module, enter (without quotes)
"Sub Summarize"
(you'll notice that you automatically get "End Sub" displayed a few lines down)

4) Paste the code I gave you between SUB SUMMARIZE and END SUB

...
Now, you can move your data so that it starts in cell A2

To run the code, click on the little green arrow button in the VBA editor window. Let's make sure it works before doing anything else...
__________________
Who believes in telekinesis... raise my hand!
Reply With Quote
  #5  
Old 11-11-2009, 04:15 PM
JP Romano's Avatar
JP Romano JP Romano is offline
Forum Contributor
 
Join Date: 09 Oct 2008
Location: Princeton, NJ
MS Office Version:2007 at work. Abacus at home
Posts: 165
JP Romano has been very helpful
Re: Lookup

Hold tight...let me upload it for you...figured out my issue... 2 min
__________________
Who believes in telekinesis... raise my hand!
Reply With Quote
  #6  
Old 11-11-2009, 04:19 PM
JP Romano's Avatar
JP Romano JP Romano is offline
Forum Contributor
 
Join Date: 09 Oct 2008
Location: Princeton, NJ
MS Office Version:2007 at work. Abacus at home
Posts: 165
JP Romano has been very helpful
Re: Lookup

Okay...try this one out...
Attached Files
File Type: xls summarize.xls (38.5 KB, 0 views)
__________________
Who believes in telekinesis... raise my hand!
Reply With Quote


Reply

Bookmarks


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
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

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off

Forum Jump