Add elements for adjacent cells by insert column based on multiple characters

abdo meghari

Well-known Member
Joined
Aug 3, 2021
Messages
612
Office Version
  1. 2019
Hello
I'm not sure if could be by macro , but what I want if the item in column B contains R & number like this 700R16 or 195R15C or 29.5R25** VSDL as bold after R letter then should add element (TIRES) in adjacent cell for column C and if the item in column B contains / then the element in column C should be TIRES and if the item in column B contains × & - then the element in column C should be TIRES like this 28×9-15 LO as bold, if the item in column B contains number & letter A then the element in column C should be BATTERY like this 70A R OR 74A L or 100A as bold, if if the item in column B contains number & × & number & L then the element in column C should be OIL like this PP MEG 24KG 4×5L or CYU MEG 4×4L as bold .

[
CC1.xlsm
ABCDE
1ITEMBATCHQTYPRICETOTAL
21235/60R184.00LYD 425.00LYD 1,700.00
32750R16 L502.00LYD 400.00LYD 800.00
43700R167.00LYD 800.00LYD 5,600.00
54215/65R164.00LYD 355.00LYD 1,420.00
65265/70R165.00LYD 550.00LYD 2,750.00
7629.5R25** VSDL24.00LYD 385.00LYD 9,240.00
87265/60R184.00LYD 540.00LYD 2,160.00
98225/75R151.00LYD 340.00LYD 340.00
109275/50R214.00LYD 780.00LYD 3,120.00
1110265/65R175.00LYD 700.00LYD 3,500.00
1211195R15C5.00LYD 600.00LYD 3,000.00
131218.4/15-30-204.00LYD 310.00LYD 1,240.00
141328×9-15 LO2.00LYD 580.00LYD 1,160.00
151470A R10.00LYD 405.00LYD 4,050.00
161560A10.00LYD 335.00LYD 3,350.00
171690A6.00LYD 470.00LYD 2,820.00
181774A L4.00LYD 310.00LYD 1,240.00
1918100A3.00LYD 490.00LYD 1,470.00
2019150A4.00LYD 650.00LYD 2,600.00
2120120A2.00LYD 565.00LYD 1,130.00
222123.5R25 18.4-301.00LYD 385.00LYD 385.00
2322PP MEG 24KG 4×5L21.00LYD 40.00LYD 840.00
2423CYU MEG 4×4L24.00LYD 50.00LYD 1,200.00
25TOTALLYD 55,115.00
combined
Cell Formulas
RangeFormula
E2:E24E2=C2*D2
E25E25=SUM(E2:E24)


result

CC1.xlsm
ABCDEF
1ITEMBATCHGROUPQTYPRICETOTAL
21235/60R18TIRES4.00LYD 425.00LYD 1,700.00
32750R16 L50TIRES2.00LYD 400.00LYD 800.00
43700R16TIRES7.00LYD 800.00LYD 5,600.00
54215/65R16TIRES4.00LYD 355.00LYD 1,420.00
65265/70R16TIRES5.00LYD 550.00LYD 2,750.00
7629.5R25** VSDLTIRES24.00LYD 385.00LYD 9,240.00
87265/60R18TIRES4.00LYD 540.00LYD 2,160.00
98225/75R15TIRES1.00LYD 340.00LYD 340.00
109275/50R21TIRES4.00LYD 780.00LYD 3,120.00
1110265/65R17TIRES5.00LYD 700.00LYD 3,500.00
1211195R15CTIRES5.00LYD 600.00LYD 3,000.00
131218.4/15-30-20TIRES4.00LYD 310.00LYD 1,240.00
141328×9-15 LOTIRES2.00LYD 580.00LYD 1,160.00
151470A RBATTERY10.00LYD 405.00LYD 4,050.00
161560ABATTERY10.00LYD 335.00LYD 3,350.00
171690ABATTERY6.00LYD 470.00LYD 2,820.00
181774A LBATTERY4.00LYD 310.00LYD 1,240.00
1918100ABATTERY3.00LYD 490.00LYD 1,470.00
2019150ABATTERY4.00LYD 650.00LYD 2,600.00
2120120ABATTERY2.00LYD 565.00LYD 1,130.00
222123.5R25 18.4-30TIRES1.00LYD 385.00LYD 385.00
2322PP MEG 24KG 4×5LOIL21.00LYD 40.00LYD 840.00
2423CYU MEG 4×4LOIL24.00LYD 50.00LYD 1,200.00
25TOTALLYD 55,115.00
EXPECTED
Cell Formulas
RangeFormula
F2:F24F2=D2*E2
F25F25=SUM(F2:F24)

should be clear data in second sheet from row 2 before bring data . if it's impossible by macro or any suggestion to make easy things I accept that or formula
thanks
 

Excel Facts

Workdays for a market open Mon, Wed, Friday?
Yes! Use "0101011" for the weekend argument in NETWORKDAYS.INTL or WORKDAY.INTL. The 7 digits start on Monday. 1 means it is a weekend.
I have also created a private chat with him for further checking
Please do NOT use the message system, all communication must remain on the board for all to see.
 
Upvote 0
Please do NOT use the message system, all communication must remain on the board for all to see.
hm sory Mr @Fluff I just asked what formulas can be done in excel 2019, I will give the answer in this thread
 
Upvote 0
How about this monster of a formula?:

Excel Formula:
=IF(OR(ISNUMBER(VALUE(MID(C2;FIND("R";C2)+1;2)));ISNUMBER(FIND("/";C2));ISNUMBER(MATCH("*×*-*";C2;0)));"TIRES";IF(ISNUMBER(VALUE(LEFT(C2;FIND("A";C2)-1)));"BATTERIES";IF(ISNUMBER(VALUE(MID(C2;FIND("×";C2)+1;FIND("L";C2)-FIND("×";C2)-1)))*ISNUMBER(VALUE(MID(C2;FIND(" ";C2;FIND("×";C2)-2)+1;FIND("×";C2)-FIND(" ";C2;FIND("×";C2)-2)-1)));"OIL";"")))
 
Upvote 0
How about now?

Libro1
ABCDEF
1ITEMBATCHGROUPQTYPRICETOTAL
21235/60R18TIRES44251700
32750R16 L50TIRES2400800
43700R16TIRES78005600
54215/65R16TIRES43551420
65265/70R16TIRES55502750
7629.5R25** VSDLTIRES243859240
87265/60R18TIRES45402160
98225/75R15TIRES1340340
109275/50R21TIRES47803120
1110265/65R17TIRES57003500
1211195R15CTIRES56003000
131218.4/15-30-20TIRES43101240
141328×9-15 LOTIRES25801160
151470A RBATTERIES104054050
161560ABATTERIES103353350
171690ABATTERIES64702820
181774A LBATTERIES43101240
1918100ABATTERIES34901470
2019150ABATTERIES46502600
2120120ABATTERIES25651130
222123.5R25 18.4-30TIRES1385385
2322PP MEG 24KG 4×5LOIL2140840
2423CYU MEG 4×4LOIL24501200
25TOTAL55115
Hoja1
Cell Formulas
RangeFormula
C2:C24C2=IF(OR(ISNUMBER(VALUE(MID(B2,FIND("R",B2) + 1,2))),ISNUMBER(FIND("/",B2)),ISNUMBER(MATCH("*×*-*",B2,0))),"TIRES",IF(ISNUMBER(VALUE(LEFT(B2,FIND("A",B2) - 1))),"BATTERIES",IF(ISNUMBER(VALUE(MID(B2,FIND("×",B2) + 1,FIND("L",B2) - FIND("×",B2) - 1))) * ISNUMBER(VALUE(MID(B2,FIND(" ",B2,FIND("×",B2) - 2) + 1,FIND("×",B2) - FIND(" ",B2,FIND("×",B2) - 2) - 1))),"OIL","")))
F2:F24F2=D2*E2
F25F25=SUM(F2:F24)
 
Upvote 0
Solution

Forum statistics

Threads
1,223,893
Messages
6,175,240
Members
452,621
Latest member
Laura_PinksBTHFT

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