If Statement based on text

Leebles

New Member
Joined
Jul 22, 2011
Messages
2
Hi,

I'm currently having issue where I'm trying to return a text value based on the start of a code.

For example, a cell might have the text D469/M081.

I grab the first 4 characters with Left(C3,4)

I want to return a text value with an IF statement like this:

If(Left(C3,4) = D469,CompanyName,A3)

The obvious problem is that D469 is referencing a cell, so I've tried with quotations like so:

If(Left(C3,4) = "D469",CompanyName,A3)

But that returns the #NAME error.

Can anyone offer any suggestions as to a way around this?

Many thanks
 

Excel Facts

Best way to learn Power Query?
Read M is for (Data) Monkey book by Ken Puls and Miguel Escobar. It is the complete guide to Power Query.
That should work without the quotes.

What does CompanyName represent?

Avlookup or just some text
 
Upvote 0
Hi and welcome to the Board
What is CompanyName ?
Is it a named range, a vlookup....??
Just changing the formula to test, try
Code:
=IF(LEFT(C3,4) = "D469","CompanyName",A3)
 
Upvote 0

Forum statistics

Threads
1,224,586
Messages
6,179,730
Members
452,939
Latest member
WCrawford

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