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

Why are there 1,048,576 rows in Excel?
The Excel team increased the size of the grid in 2007. There are 2^20 rows and 2^14 columns for a total of 17 billion cells.
Try

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

M.
 
Upvote 0

Forum statistics

Threads
1,215,604
Messages
6,125,792
Members
449,260
Latest member
Mrw1

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