Search for different strings in a cell to return different results in another cell

lctradingni

New Member
Joined
Sep 19, 2018
Messages
2
[TABLE="width: 500"]
<tbody>[TR]
[TD]NAME[/TD]
[TD]PRICE PER PACK[/TD]
[TD]NO. PER PACK[/TD]
[TD]PRICE PER UNIT[/TD]
[/TR]
[TR]
[TD][TABLE="width: 128"]
<tbody>[TR]
[TD="width: 128"]product a 2 x 150ml[/TD]
[/TR]
</tbody>[/TABLE]
[/TD]
[TD]24[/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD][TABLE="width: 128"]
<tbody>[TR]
[TD="width: 128"]product b 3 x 200ml[/TD]
[/TR]
</tbody>[/TABLE]
[/TD]
[TD]13[/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD][TABLE="width: 128"]
<tbody>[TR]
[TD="width: 128"]product c 6 x 300ml[/TD]
[/TR]
</tbody>[/TABLE]
[/TD]
[TD]64[/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD][TABLE="width: 128"]
<tbody>[TR]
[TD="width: 128"]product d 4 x 500ml[/TD]
[/TR]
</tbody>[/TABLE]
[/TD]
[TD]46[/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD][TABLE="width: 128"]
<tbody>[TR]
[TD="width: 128"]product e[/TD]
[/TR]
</tbody>[/TABLE]
[/TD]
[TD]12[/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD][TABLE="width: 128"]
<tbody>[TR]
[TD="width: 128"]product f 2 x 150ml[/TD]
[/TR]
</tbody>[/TABLE]
[/TD]
[TD]75[/TD]
[TD][/TD]
[TD][/TD]
[/TR]
</tbody>[/TABLE]

I have a set of data like this. I require a formula that looks for the strings "2 x", "3 x", "4 x" etc in column A and returns the corresponding number in cell c to allow me to quickly work out my cost prices per unit instead of per pack. I've tried loads of formulas but can't get it working. The highest I would really need is up to "6 x" but an explanation of how to add bigger pack quantites e.g. "16 x" etc would be really appreciated. Thanks!
 

Excel Facts

Will the fill handle fill 1, 2, 3?
Yes! Type 1 in a cell. Hold down Ctrl while you drag the fill handle.
Hi & welcome to MrExcel.
How about
=IFERROR(TRIM(RIGHT(LEFT(A2,SEARCH("x",A2)-1),3)),"")
 
Upvote 0
.. an explanation of how to add bigger pack quantites e.g. "16 x" etc would be really appreciated. Thanks!
Welcome to the MrExcel board!

Try this copied down. I have not used IFERROR to hide the error value as I thought it might be something you would want to notice if there was no quantity.
I have also included the spaces around the " x " in the SEARCH() so that you don't get a problem if the product name includes that character (eg "Extra big soap")

Excel Workbook
ABC
1NAMEPRICE PER PACKNO. PER PACK
2product a 2 x 150ml242
3product b 3 x 200ml133
4product c 6 x 300ml646
5product d 4500 x 500ml464500
6product e12#VALUE!
7product f 200 x 150ml75200
No per pack
 
Last edited:
Upvote 0

Forum statistics

Threads
1,223,952
Messages
6,175,594
Members
452,654
Latest member
mememe101

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