If column A contains then add B

Dharmalingam

New Member
Joined
Jan 8, 2014
Messages
34
Hi,

Could any one pls help me here, im having sheet with below values in column A (it contains n number of values)
<clientname>RBS</clientname>
<customerid>98</customerid>
<customerreference>H12</customerreference>
<customerid>A34</customerid>
<customerreference>WR2</customerreference>
<clientname>TSQ</clientname>
<clientcode></clientcode>
<clientcontact>98765432<clientcontact></clientcontact></clientcontact>
<clientname></clientname>

<tbody>
</tbody>

If Column A contains the word Clientname then i need to add 1 into column B, in same way if Column A contains the word CustomerId then i need to add 2 into its respective Column B, like below could any one pls.

<clientname>RBS</clientname>

<tbody>
</tbody>
1
<customerid>98</customerid>

<tbody>
</tbody>
2
<customerreference>H12</customerreference>

<tbody>
</tbody>
<customerid>A34</customerid>

<tbody>
</tbody>
2
<customerreference>WR2</customerreference>

<tbody>
</tbody>
<clientname>TSQ</clientname>

<tbody>
</tbody>
1
<clientcode></clientcode>

<tbody>
</tbody>
<clientcontact>98765432<clientcontact></clientcontact></clientcontact>

<tbody>
</tbody>
<clientname></clientname>

<tbody>
</tbody>
1

<tbody>
</tbody>

Thank you very much for your help.

Thanks,
Dharma.
 

Excel Facts

Square and cube roots
The =SQRT(25) is a square root. For a cube root, use =125^(1/3). For a fourth root, use =625^(1/4).
Try

B1
=IF(ISNUMBER(SEARCH("clientname",A1)),1,IF(ISNUMBER(SEARCH("customerid",A1)),2,""))
copy down

M.
 
Upvote 0

Forum statistics

Threads
1,214,975
Messages
6,122,538
Members
449,088
Latest member
RandomExceller01

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