Return Text if Number Matches

tlc53

Active Member
Joined
Jul 26, 2018
Messages
399
Hi,

I have been trying to figure out this formula for sometime and feel it's now time to call in the experts.

A2:A10 Account Code (format ### or ###/###)
B2:B10 Account Description (text)

B15 - This is a manual entry tab, you enter the account number
B16 = I want this cell to return the Account Description from B2:B10 depending on the account number entered above, in B15.

Thanks very much.
 

Excel Facts

What is the last column in Excel?
Excel columns run from A to Z, AA to AZ, AAA to XFD. The last column is XFD.
My suggestion would be to use a UDF supply cell and range optional lookup column and optional return column and get either empty string or description per your request or do you need it to be a formula?
 
Upvote 0
What am I missing? Isn't it a VLOOKUP?

Code:
=VLOOKUP(B15,A1:B10,2,FALSE)
 
Upvote 0
Book1
AB
1Acct CodeDesc
2ABCFirst description
3999Second description
4ABC/111Third descripton
5
6
7
8
9
10
11
12
13
14
15ABC/111
16Third descripton
Sheet2
Cell Formulas
RangeFormula
B16B16=VLOOKUP(B15,A1:B14,2,FALSE)
 
Upvote 0
What am I missing? Isn't it a VLOOKUP?

Code:
=VLOOKUP(B15,A1:B10,2,FALSE)
Thank you. This works if the account numbers are plainly typed into A2:A10. However, for example, even though the cell A5 visually shows 196 the formula in that cell is actually;

=IF('XPA Data Table'!B839="",TEXT('XPA Data Table'!A839,"000"),TEXT('XPA Data Table'!A839,"000")&"/"&TEXT('XPA Data Table'!B839,"000"))

This seems to be affecting the result and returns #N/A instead of returning the description from B2:B10. Is there a way I can amend the formula to allow for this? Thanks.
 
Upvote 0
Doesn't the data possibly look like this?

Book1
AB
1Acct CodeDesc
2999First description
3123/456Second description
4555/666Third descripton
Sheet2
 
Upvote 0
Doesn't the data possibly look like this?
Yes, that's basically how it looks. I'm noticing that when I enter an account code in the format ###/### the formula works fine and the description shows. However, if the account number is, for example, 999, it returns #N/A

Interesting - if I enter '999 the formula works but it doesn't work with just 999
 
Upvote 0
Try

Replacing 000 to 000&"" in your formula.

Meaning just add & and double quotes after 000.
 
Upvote 0
Try

Replacing 000 to 000&"" in your formula.

Meaning just add & and double quotes after 000.
Thanks. I see where you were getting at with that but it didn't fix the problem..

=IF('XPA Data Table'!B839="",TEXT('XPA Data Table'!A839,"000")&"",TEXT('XPA Data Table'!A839,"000")&"/"&TEXT('XPA Data Table'!B839,"000"))
 
Upvote 0

Forum statistics

Threads
1,214,641
Messages
6,120,693
Members
448,979
Latest member
DET4492

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