Solved

# Excel Formula to search part of

Posted on 2016-08-11
45 Views
Hello,
I'm trying to search part of text in one column and get results back from another sheet.
I tried below formulas, but not getting proper results.

=IFERROR(VLOOKUP("*"&LEFT(\$A2,15)&"*", Daily_Orders!\$B:\$S, 3,FALSE),"")
=IF(ISNA(VLOOKUP("*"&LEFT(\$A2,15)&"*",Daily_Orders!\$B:\$S,1,0)),"",Daily_Orders!B2)

Example in Column A to lookup
124453367
64445369979335357682
TR: 909334288787
TR: 54998762445, 8796498126409,221421414
M22300061070000010093

Thanks,
0
Question by:Wass_QA

LVL 48

Expert Comment

Hi,

Could you send a sample?

Regards
0

LVL 43

Expert Comment

What do you have in

Daily_Orders!\$B:\$S
0

Author Comment

Please see attached sample,

here's what I have,
I need to scan few hundred orders into Column A,
after I'm done,
In Column B,C,D,.....
I need to search the tracking in the Daily_Orders tab.
And return
Columns b,c,d,e,.........

One Example,
if I scan 8796498126409, it should find it in the Daily_orders tab (Column S) --
TR: 54998762445, 8796498126409,221421414
And return
Columns b,c,d,e,.........
Sample.xlsx
0

LVL 31

Accepted Solution

Rob Henson earned 500 total points
Try this:

Col B =INDEX(Daily_Orders!\$B\$2:\$U\$6,MATCH("*"&\$A5&"*",Daily_Orders!\$S\$2:\$S\$6,0),1)
Col C =INDEX(Daily_Orders!\$B\$2:\$U\$6,MATCH("*"&\$A5&"*",Daily_Orders!\$S\$2:\$S\$6,0),2)
Col D =INDEX(Daily_Orders!\$B\$2:\$U\$6,MATCH("*"&\$A5&"*",Daily_Orders!\$S\$2:\$S\$6,0),3)
Col E =INDEX(Daily_Orders!\$B\$2:\$U\$6,MATCH("*"&\$A5&"*",Daily_Orders!\$S\$2:\$S\$6,0),4)

Adjust "Daily_Orders!\$B\$2:\$U\$6" to the full range and "Daily_Orders!\$S\$2:\$S\$6" to the full height of column S.

VLOOKUP relies on the lookup value being in the leftmost column of your lookup area.
0

LVL 31

Expert Comment

If your proper data has unique column headers, and they are the same across the source and the result tables, the column index at the end of the above formula can be adjusted to a MATCH formula to find the relevant column Header.
0

Author Comment

Hi Rob,
yes they have unique column headers,
And the same in both sheets.
0

LVL 9

Expert Comment

I'm wondering why the daily orders are put into the same cell in column S.  It might be a better practice to have a separate row for each of the daily orders, especially if there is a focus on searching and manipulating your data based on individual column S entries.

Would you be able to get column S to list a separate row for each datum in column S?

Then to try to rephrase to make sure we're thinking alike...

You would start with two worksheets.  One is the Daily Orders tab, the other worksheet is blank with a tab named Scan, and you scan into column A of the blank sheet a few hundred entries.  Then, miraculously, the data in the remaining columns of Scan tab is populated by transferred data from Daily Orders tab, for whatever row provides a match.  Is that correct?

Also, if searching data in Daily Orders tab, using the data from column A of Scan tab, are you only looking at column S of Daily Orders tab, or all the data in the Daily Orders tab?
0

Author Comment

Rob,
I tried the formula,
it's working only on numbers.

64371415471655
6243371415988067110
67682517141613

not worling on below example (Getting #N/A)
M22300061070000010093
M22300061070000010152
0

Author Comment

Hi Chris,
the codes I'm scanning are not always to be found in Column S.
different clients, different columns to use.
So, I'll be looking through all columns (A-S)

Thanks
0

LVL 31

Expert Comment

Your last comment answers why you are getting #N/A for the entries starting M223.

They are not present in column S so the formula is not finding them.

All standard lookup formulas (INDEX, LOOKUP etc) rely on the lookup value being in one column; I suspect a multiple column scan can be achieved with VBA or a User Defined Function (effectively VBA embedded into a formula).
0

Author Closing Comment

Thanks Rob,
your formula worked like a charm , with some tweaks,
0

## Join & Write a Comment Already a member? Login.

A little background as to how I came to I design this code: Around 5 years ago I designed an add-in that formatted Excel files to a corporate standard, applying different cell colours and font type depending on whether the cells contained inputs,…
Introduction This Article briefly covers methods of calculating the NPV and IRR variants in Excel as well as the limitations in calculating and interpreting IRR results. Paraphrasing Richard Shockley, author of my favourite finance reference tex…
The viewer will learn how to create two correlated normally distributed random variables in Excel, use a normal distribution to simulate the return on different levels of investment in each of the two funds over a period of ten years, and, create a …
Excel styles will make formatting consistent and let you apply and change formatting faster. In this tutorial, you'll learn how to use Excel's built-in styles, how to modify styles, and how to create your own. You'll also learn how to use your custo…

#### 744 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

#### Need Help in Real-Time?

Connect with top rated Experts

11 Experts available now in Live!