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

lctradingni

New Member
Joined
Sep 19, 2018
Messages
2
NAMEPRICE PER PACKNO. PER PACKPRICE PER UNIT
product a 2 x 150ml

<tbody>
</tbody>
24
product b 3 x 200ml

<tbody>
</tbody>
13
product c 6 x 300ml

<tbody>
</tbody>
64
product d 4 x 500ml

<tbody>
</tbody>
46
product e

<tbody>
</tbody>
12
product f 2 x 150ml

<tbody>
</tbody>
75

<tbody>
</tbody>

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

Can Excel fill bagel flavors?
You can teach Excel a new custom list. Type the list in cells, File, Options, Advanced, Edit Custom Lists, Import, OK
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,221,310
Messages
6,159,176
Members
451,543
Latest member
cesymcox

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