Inserting Text Into an IF Statement

Hoosier03

Board Regular
Joined
Apr 29, 2011
Messages
121
I am using Excel 2007.

I have two lookups that are referencing two workbooks. The problem I have is the numbers in my workbooks are different. They are in regular text. The numbers in the other workbook all have a ' sign in front of them. For example my workbook has 1004. The other workbook has '1004. I cannot change the numbers in either workbook. Is there a way I can create a lookup that inserts the ' if the number is numerical? Not all the numbers have the problem. The ones that start with text, like
AR132509BB1 are fine.

<tbody>
</tbody>


Any thoughts?

Thanks,

Rodney
 

Excel Facts

How to change case of text in Excel?
Use =UPPER() for upper case, =LOWER() for lower case, and =PROPER() for proper case. PROPER won't capitalize second c in Mccartney
Hi,

you can do it like my vlookup below. Note I coerced the lookup value of 1004 into text by concatenating a null string.


=VLOOKUP(""&A2,I2:J23,2,FALSE)
 
Upvote 0
That's because the number in your workbook is stored as a number, but the number with the ' is stored as text. You can make your look up value text like so:

=VLOOKUP(""&1004,A1:B3,2,0)

Does that help?
 
Upvote 0
Sorry I was not more clear on this, but the lookup function is INDEX MATCH. VLOOKUP won't work in this situation.

Thanks,

Rodney
 
Upvote 0
The same concept will still apply. What is the formula that you're using now?
 
Upvote 0
=INDEX('[Item Listing with Product Detail.xlsx]ITEM LISTING WITH PRODUCT LINE'!$A$3:$A$50901, (MATCH(A3, '[Item Listing with Product Detail.xlsx]ITEM LISTING WITH PRODUCT LINE'!$B$3:$B$50901, 0)))

Also note that not all of the returns need the ' symbol in front of them. The ones that begin with letters do not need this just the ones that begin with numbers.

Thanks,

Rodney
 
Upvote 0
Try:

=INDEX('[Item Listing with Product Detail.xlsx]ITEM LISTING WITH PRODUCT LINE'!$A$3:$A$50901, (MATCH(""&A3, '[Item Listing with Product Detail.xlsx]ITEM LISTING WITH PRODUCT LINE'!$B$3:$B$50901, 0)))
 
Upvote 0
You just need a condition for your lookup value.

=INDEX('[Item Listing with Product Detail.xlsx]ITEM LISTING WITH PRODUCT LINE'!$A:$A,MATCH(IF(ISNUMBER(A3),"'"&A3,A3),'[Item Listing with Product Detail.xlsx]ITEM LISTING WITH PRODUCT LINE'!$B:$B,0))
 
Upvote 0
You just need a condition for your lookup value.

=INDEX('[Item Listing with Product Detail.xlsx]ITEM LISTING WITH PRODUCT LINE'!$A:$A,MATCH(IF(ISNUMBER(A3),"'"&A3,A3),'[Item Listing with Product Detail.xlsx]ITEM LISTING WITH PRODUCT LINE'!$B:$B,0))

The condition is not necessary. Adding the null string will convert any numbers to text and won't affect data that is already text.
 
Upvote 0
It's not null... it's " ' " << notice the little apostrophe in between... just adding an apostrophe before the number to match what's on the other workbook.
 
Upvote 0

Forum statistics

Threads
1,213,522
Messages
6,114,112
Members
448,549
Latest member
brianhfield

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