liamlarmour

New Member
Joined
May 4, 2017
Messages
4
Hi

I'm trying to create a formula to deliver three different outputs based on conditions of three columns.

Conditions:

IF a2 = 11 AND d2 = 028 return NI Landline OR
IF a2 = 11 AND c2 = 07 return Mobile OR
IF a2 <>11 return Other Number

It;s necessary to check Col C for 028 to verify it's a NI Landline, and Col B for 07 to verify it's a UK mobile number - both will have 11 digits. Those that don't have 11 digits are likely to be incorrectly formatted numbers or non NI/-UK numbers.

ColumnABCD
RowNumber of DigitsFirst Two First ThreeNumber Type
11102028NI Landline
21107077Mobile
31326269Other Number
41102028NI Landline
51102028NI Landline
61107077Mobile
71102028NI Landline
81107079Mobile
91107077Mobile
101102028NI Landline
111107077Mobile
121102028NI Landline
131102028NI Landline
141102028NI Landline
151102028NI Landline
161107078Mobile

<colgroup><col><col><col><col><col></colgroup><tbody>
</tbody>


I tried the below formula but it only returns Other Number for all rows:

IF((AND(G2="11",I2="028")),"NI Landline",IF((AND(G2="11",H2="07")),"Mobile","Other Number"))

I guess I am doing something obviously wrong that I'll hit myself once it's pointed out to me, but I would be grateful for any advice.

Thanks
Liam
 

Excel Facts

Excel Wisdom
Using a mouse in Excel is the work equivalent of wearing a lanyard when you first get to college
Have you tried your formula without the quotes around the numbers in your AND statements, like 11 instead of "11", and 028 instead of "028"?
 
Upvote 0
The only thing I could point out is the extra, unnecessary, parenthesis.

IF((AND(G2="11",I2="028")),"NI Landline",IF((AND(G2="11",H2="07")),"Mobile","Other Number"))

Otherwise, I would make sure your G2 and I2 values are indeed text because the formula is looking for a text value. If they are NOT text, but numbers formatted to keep the leading 0, then you need to remove the "" from the 11, 028 and 07 in the formula.
 
Last edited:
Upvote 0
Have you tried your formula without the quotes around the numbers in your AND statements, like 11 instead of "11", and 028 instead of "028"?

Hi,

Agree with you philwojo, the 11, yes, but probably not the "028" as that Looks like it may be text.
 
Last edited:
Upvote 0
Hi folks

Thanks for your replies, apologies for my very late response, got caught up with other workstuff.

The telephone numbers are all text and the 11 is a =LEN() result. I'm still working on this, but have started using some workarounds and shortcuts. I'll keep coming back to this formula as I like the challenge, so I appreciate all of your help.

Liam
 
Upvote 0
Hi folks

Thanks for your replies, apologies for my very late response, got caught up with other workstuff.

The telephone numbers are all text and the 11 is a =LEN() result. I'm still working on this, but have started using some workarounds and shortcuts. I'll keep coming back to this formula as I like the challenge, so I appreciate all of your help.

Liam

Hi,

As suggested above, since your G Column is result of LEN formula, it IS a number and Not text, while the H and I Columns are Text, just adjust your formula like below.
You were getting "Other Number" for all rows because the IF formula testing G2="11" always fails, since G2 is the number 11, Not the Text "11".


Book1
GHIJ
1Number of DigitsFirst TwoFirst ThreeNumber Type
21102028NI Landline
31107077Mobile
41326269Other Number
51102028NI Landline
61102028NI Landline
7907077Other Number
81102028NI Landline
91107079Mobile
101107077Mobile
111102028NI Landline
121107077Mobile
131102028NI Landline
141102028NI Landline
151102028NI Landline
161102028NI Landline
171107078Mobile
Sheet32
Cell Formulas
RangeFormula
J2=IF(AND(G2=11,I2="028"),"NI Landline",IF(AND(G2=11,H2="07"),"Mobile","Other Number"))
 
Upvote 0

Forum statistics

Threads
1,220,965
Messages
6,157,119
Members
451,398
Latest member
rjsteward

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