Need Excel formula to Pick value based on conditions

Aswinraj

Board Regular
Joined
Dec 10, 2015
Messages
65
Hi Friends,

I wonder whether any formulas available for changing the data based on certain conditions.

Example Based on Below Table:

If Last 3 Letters in Column B is "mer" and Column A is "9G" then in Column C - it has to give as "SG"
else it has to give the same data in Column A.


Column AColumn B
9GConsumer
9TMobility
FFMobility
8N

<tbody>
</tbody>
Commercial

<tbody>
</tbody>
TA

<tbody>
</tbody>
Commercial

<tbody>
</tbody>
MP

<tbody>
</tbody>
Commercial

<tbody>
</tbody>
B6U

<tbody>
</tbody>
Commercial

<tbody>
</tbody>
B8J

<tbody>
</tbody>
Commercial

<tbody>
</tbody>
BAN

<tbody>
</tbody>
Commer

<tbody>
</tbody>
9G

<tbody>
</tbody>
Commer

<tbody>
</tbody>
BFF

<tbody>
</tbody>
Commercial

<tbody>
</tbody>
BAN

<tbody>
</tbody>
Commer

<tbody>
</tbody>
BGB

<tbody>
</tbody>
Commercial

<tbody>
</tbody>
9G

<tbody>
</tbody>
Commer

<tbody>
</tbody>
BTA

<tbody>
</tbody>
Commercial

<tbody>
</tbody>
9G

<tbody>
</tbody>
Consumer

<tbody>
</tbody>
BFD

<tbody>
</tbody>
Commer

<tbody>
</tbody>

<tbody>
</tbody>
 

Excel Facts

Remove leading & trailing spaces
Save as CSV to remove all leading and trailing spaces. It is faster than using TRIM().
How about this in C1

=IF(AND(RIGHT(B1,3)="mer",A1="9G"),"SG",A1)
 
Upvote 0
Hi mse330,

Now the formula is if B column contains "Mer" and A column contains 9G then it will display "SG".

Just to learn, is it possible to have two condition..?? I mean, if B column contains "Mer" and A column contains "9G" and "GG" then it should display "SG".
 
Upvote 0
Something like...

=IF(AND(ISNUMBER(LOOKUP(9.99999999999999E+307,SEARCH("9G","GG",$A1))),ISNUMBER(SEARCH("mer",$B1)),"SG","")
 
Upvote 0
Hi mse330,

Just to learn, is it possible to have two condition..?? I mean, if B column contains "Mer" and A column contains "9G" and "GG" then it should display "SG".

So column A should include both "9G" & "GG" or either one ?
 
Upvote 0
@mse330 I found it., =IF(AND(RIGHT(B13,3)="mer",A13="9G",A13="GG"),"SG",A13) - it works.

But i Missed to provide some informations, sorry.., Actually it needs to pickup the data from one sheet to another sheet.
Please help..,


Example:
Sheet 1 Data:

It contains 3 Columns A, B and C..,

If Last 3 Letters in Column B is "mer" and Column A is "9G" and "GG"

Sheet 2 Data


If Last 3 Letters in Column B is "mer" and Column A is "9G" and "GG" then it has to pickup the data from Column C - Book 1.

Like a Vlookup.


With Regards,
Aswinraj A
 
Last edited:
Upvote 0
@Aswinraj


I don't think this formula is correct/logical
=IF(AND(RIGHT(B13,3)="mer",A13="9G",A13="GG"),"SG",A13) … This will never return "SG" as it is evaluating the content in cell A13 to be "9G" & "GG" … Maybe this is what you're looking for =IF(AND(RIGHT(B13,3)="mer",OR(A13="9G",A13="GG")),"SG",A13)

What is in column C in sheet 1 ? Would a vlookup work? Or it should just take the value of column C in the same row ?
 
Upvote 0
Try to post 5 rows from Sheet1 and 5 rows from Sheet2 and describe the results which must obtain.
@Aladin Akyurek @mse330

From Sheet 1: If Last 3 Letters in Column B is "mer" and Column A is "9G" and "GG" then it has to lookup with

Sheet 2
If Last 3 Letters in Column B is "mer" and Column A is "9G" and "GG" then it has to pickup the data from Column C in Sheet 1.

Hope now its clear :)
:):)
Sheet 1 Table
ABC
9GConsumer50
9TCommerical1
FFMobile8000
GGConsumer77

<tbody>
</tbody>

Sheet 2 Table
ABC
9GConsumer50
FTComm#N/A
GGConsumer77
PFMobile#N/A

<tbody>
</tbody>
 
Last edited:
Upvote 0

Forum statistics

Threads
1,214,863
Messages
6,121,978
Members
449,058
Latest member
oculus

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