• Skip to main content
  • Skip to header right navigation
  • Skip to site footer

My Online Training Hub

Learn Dashboards, Excel, Power BI, Power Query, Power Pivot

  • Courses
  • Pricing
    • Free Courses
    • Power BI Course
    • Excel Power Query Course
    • Power Pivot and DAX Course
    • Excel Dashboard Course
    • Excel PivotTable Course – Quick Start
    • Advanced Excel Formulas Course
    • Excel Expert Advanced Excel Training
    • Excel Tables Course
    • Excel, Word, Outlook
    • Financial Modelling Course
    • Excel PivotTable Course
    • Excel for Customer Service Professionals
    • Excel for Operations Management Course
    • Excel for Decision Making Under Uncertainty Course
    • Excel for Finance Course
    • Excel Analysis ToolPak Course
    • Multi-User Pricing
  • Resources
    • Free Downloads
    • Excel Functions Explained
    • Excel Formulas
    • Excel Add-ins
    • IF Function
      • Excel IF Statement Explained
      • Excel IF AND OR Functions
      • IF Formula Builder
    • Time & Dates in Excel
      • Excel Date & Time
      • Calculating Time in Excel
      • Excel Time Calculation Tricks
      • Excel Date and Time Formatting
    • Excel Keyboard Shortcuts
    • Excel Custom Number Format Guide
    • Pivot Tables Guide
    • VLOOKUP Guide
    • ALT Codes
    • Excel VBA & Macros
    • Excel User Forms
    • VBA String Functions
  • Members
    • Login
  • Blog
  • Excel Webinars
  • Excel Forum
    • Register as Forum Member
  • Login

search multiple sheets, return multiple values |General Excel Questions & Answers|Excel Forum|My Online Training Hub

You are here: Home / search multiple sheets, return multiple values |General Excel Questions & Answers|Excel Forum|My Online Training Hub
Avatar
sp_LogInOut Log In sp_Registration Register
sp_Search Search
Advanced Search
Search
Forum Scope




Match



Forum Options



Minimum search word length is 3 characters - maximum search word length is 84 characters
sp_Search Search
sp_RankInfo
Lost password?
sp_CrumbsHome HomeExcel ForumGeneral Excel Questions & Answe…search multiple sheets, return mult…
sp_PrintTopic sp_TopicIcon
search multiple sheets, return multiple values
Avatar
Collin Runkel

New Member
Members
Level 0
Forum Posts: 2
Member Since:
October 8, 2020
sp_UserOfflineSmall Offline
1
October 8, 2020 - 5:17 am
sp_Permalink sp_Print sp_EditHistory

Hello,

 

I am looking to input a number and have a formula search multiple sheets for that number in column A, and return all values in column B associated with the input. I have my sheets named Book 1, Book 2, etc. Under the DWG # column you will see that some numbers are repeated in the same sheet and on other sheets. For example, DWG # 8306305 appears on Book 1 (twice), on Book 2 (once) and Book 3 (once). I would like to have all the corresponding ECN #'s be outputted. For example, input 8306305 and in the next column I want to see 2, 145, 621, 700. It doesn't matter if the ECN #'s are in the same cell or positioned vertically. As you will see I have figured out how to return the very first ECN # of the inputted value, however, I need all of them. I have hit a dead end with google. Thank you!

 

P.S. I should also add that in the end each "book" will have ~200 or so values. Just trying to prove a concept right now.

sp_AnswersTopicSeeAnswer See Answer
Avatar
Purfleet
England
Member
Members


Trusted Members
Level 4
Forum Posts: 414
Member Since:
December 20, 2019
sp_UserOfflineSmall Offline
2
October 8, 2020 - 5:57 pm
sp_Permalink sp_Print

How about a little macro to do it?

Sub LookupDWG()

Dim ws As Worksheet
Dim DWG As String
Dim i As Integer
Dim LR As Long
Dim c As Range
Dim DWGr As Range

DWG = Worksheets("MAIN SEARCH").Range("A2")

i = 1

For Each ws In ActiveWorkbook.Worksheets

If ws.Name = "NAME RANGE" Or ws.Name = "MAIN SEARCH" Then
GoTo SkipI

End If

LR = ws.Cells(Rows.Count, 1).End(xlUp).Row

Set DWGr = ws.Range("a1:a" & LR)

For Each c In DWGr
If c.Value = DWG Then
i = i + 1
Worksheets("MAIN SEARCH").Range("B" & i) = c.Offset(0, 1)
End If
Next c

SkipI:

Next ws

End Sub

sp_AnswersTopicAnswer
Answers Post
Avatar
Collin Runkel

New Member
Members
Level 0
Forum Posts: 2
Member Since:
October 8, 2020
sp_UserOfflineSmall Offline
3
October 8, 2020 - 10:42 pm
sp_Permalink sp_Print

That worked quite well, thank you! One last thing here. I noticed that when I search for a second DWG # that it won't clear out the results from the previous search. Say I return 5 results on my first search and then on my next search only 2 results come back. Well, a total of 5 results will be there but only the first (2) will related to the second search and the last 3 are related to the first search. How could I remedy this? Thank you for your help!

Avatar
Lionel Baijot
Member
Members
Level 0
Forum Posts: 119
Member Since:
September 9, 2020
sp_UserOfflineSmall Offline
4
October 9, 2020 - 2:13 pm
sp_Permalink sp_Print

With a small adaptation of the Purfleet code 😉 ...

 

LastRow = Range("B1").End(xlDown).Row
Sheets("MAIN SEARCH").Range("B2:B" & LastRow).ClearContents

sp_Feed
Go to top
Forum Timezone: Australia/Brisbane
Most Users Ever Online: 245
Currently Online: Martin Delloca, Tracy English, Joaquim Amorim
Guest(s) 12
Currently Browsing this Page:
1 Guest(s)
Top Posters:
SunnyKow: 1432
Anders Sehlstedt: 880
Purfleet: 414
Frans Visser: 346
David_Ng: 306
lea cohen: 237
Jessica Stewart: 219
A.Maurizio: 213
Aye Mu: 201
jaryszek: 183
Newest Members:
Rob Rooth
Tom Lewis
Jennifer Rodriguez-Avila
Khaled Ibrahim
Kiran Supekar
Lisa Myers
Ronald White
Ginette Guevremont
Taryn Ambrosi
Mark Davenport
Forum Stats:
Groups: 3
Forums: 24
Topics: 6531
Posts: 28604

 

Member Stats:
Guest Posters: 49
Members: 32822
Moderators: 2
Admins: 4
Administrators: Mynda Treacy, Philip Treacy, Catalin Bombea, FT
Moderators: Velouria, Riny van Eekelen
© Simple:Press —sp_Information

Sidebar

Blog Categories

  • Excel
  • Excel Charts
  • Excel Dashboard
  • Excel Formulas
  • Excel Office Scripts
  • Excel PivotTables
  • Excel Shortcuts
  • Excel VBA
  • General Tips
  • Online Training
  • Outlook
  • Power Apps
  • Power Automate
  • Power BI
  • Power Pivot
  • Power Query
microsoft mvp logo
trustpilot excellent rating
Secured by Sucuri Badge
MyOnlineTrainingHub on YouTube Mynda Treacy on Linked In Mynda Treacy on Instagram Mynda Treacy on Twitter Mynda Treacy on Pinterest MyOnlineTrainingHub on Facebook

Sign up to our newsletter and join over 400,000
others who learn Excel and Power BI with us.

 

Company

  • About My Online Training Hub
  • Disclosure Statement
  • Frequently Asked Questions
  • Guarantee
  • Privacy Policy
  • Terms & Conditions
  • Testimonials
  • Become an Affiliate
  • Sponsor Our Newsletter

Support

  • Contact
  • Forum
  • Helpdesk - For Technical Issues

Copyright © 2023 · My Online Training Hub · All Rights Reserved. Microsoft and the Microsoft Office logo are trademarks or registered trademarks of Microsoft Corporation in the United States and/or other countries. Product names, logos, brands, and other trademarks featured or referred to within this website are the property of their respective trademark holders.