if statement

ncapanzana

New Member
Joined
Mar 13, 2013
Messages
13
Hello,

I need your expertise on excel pls.

I want to populate the column A based on the data available in B, C and D. how can I achieve this? I have to do it

Rules:
1. If the values in column B start with MP or MB, put 'METRO' in the same row in column A
2. If the values in column C start with OM, put 'OTHERS' in the same row in column A
3. If column B and column C are NULL/Blank and the value in column D is <8 , put 'CASH' in the same row in column A
4. If column B and column C are NULL/Blank and the value in column D is >=8, put 'DOOR' in the same row in column A

Notes: if there is a value in column B, column C is always NULL
If there is a value in column C, column B is always NULL

[TABLE="class: grid, width: 500, align: center"]
<tbody>[TR]
[TD]A[/TD]
[TD]B[/TD]
[TD]C[/TD]
[TD]D[/TD]
[/TR]
[TR]
[TD][/TD]
[TD]MB9874[/TD]
[TD][/TD]
[TD]41[/TD]
[/TR]
[TR]
[TD][/TD]
[TD]MP97124[/TD]
[TD][/TD]
[TD]8[/TD]
[/TR]
[TR]
[TD][/TD]
[TD][/TD]
[TD]OM[/TD]
[TD]9[/TD]
[/TR]
[TR]
[TD][/TD]
[TD][/TD]
[TD]OM[/TD]
[TD]4[/TD]
[/TR]
[TR]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD]3[/TD]
[/TR]
[TR]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD]7[/TD]
[/TR]
[TR]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD]3.9[/TD]
[/TR]
[TR]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD]8[/TD]
[/TR]
[TR]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD]8.5[/TD]
[/TR]
[TR]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD]10[/TD]
[/TR]
</tbody>[/TABLE]

Thanks
Nino
 

Excel Facts

Bring active cell back into view
Start at A1 and select to A9999 while writing a formula, you can't see A1 anymore. Press Ctrl+Backspace to bring active cell into view.
=if(or(left(Bx,2)="MB",left(Bx,2)="MP"),"METRO",if(left(Cx,2)="OM","OTHERS",if(Dx<8,"CASH","DOOR")))
 
Upvote 0
This may not be absolutely correct. The sample data does not show a case where there is something in B other than an MB or MP. This assumes if it is not MP or MB column B is treated as empty. The same for Column C having something other than OM in it.
 
Upvote 0
or another

Excel 2010
ABCD
2METROMB987441
3METROMP971248
4OthersOM9
5OthersOM4
6CASH3
7CASH7
8CASH3.9
9DOOR8
10DOOR8.5
11DOOR10
Sheet1
Cell Formulas
RangeFormula
A2=IF(OR(LEFT(B2,2)={"MP","MB"}),"METRO",IF(C2="OM","Others",IF(AND(B2="",C2="",D2<8),"CASH",IF(AND(B2="",C2="",D2>=8),"DOOR",""))))
 
Upvote 0

Forum statistics

Threads
1,223,063
Messages
6,169,888
Members
452,288
Latest member
neplecha

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