Add Lines with Total Quantity If Found

tizdall

New Member
Joined
Apr 10, 2013
Messages
17
Hello!

I have lists of product information on a worksheet and I need to add Screws to an order if one of our products exists in the list on the worksheet.

First, I need to find the part I am looking for in the column, sum the quantities and then add 2 rows to the last row with data displaying the total quantity*1.2.

As an example, I would start with this in excel:

RowProduct NameQuantity
10Plank2
11Board2
12HW5
13Board3
14Nails50

<tbody>
</tbody>


And I want it to add 2 lines to the last row (won't always be row 14, I'll need to find the last row with data) so it would look like this:

RowProduct NameQuantity
10Plank2
11Board2
12HW5
13Board3
14Nails50
15Screws
16Screws5*1.2

<tbody>
</tbody>

In this example I need to add 1.2 screws for every board in the list. So the total number of boards would be 5 so the total number of screws i need would be 6.

If the file does not contain the product then no screws would be added.

I am hoping I can make this using vba so that I can hit a button, it will see if there are 'boards.' If there are, sum the total quantity of 'boards' in the list, multiply it by 1.2 and display that amount in two new rows added to the bottom of the last row with data. The name should read 'Screws' for these lines.

Any help would be greatly appreciated!!
 

Excel Facts

Format cells as date
Select range and press Ctrl+Shift+3 to format cells as date. (Shift 3 is the # sign which sort of looks like a small calendar).
Sheet2

*ABC
1RowProduct NameQuantity
210Plank2
311Board2
412HW5
513Board3
614Nails50
715Screws*
816Screws6

<colgroup><col style="font-weight:bold; width:30px; "><col style="width:64px;"><col style="width:64px;"><col style="width:64px;"></colgroup><tbody>
</tbody>

Spreadsheet Formulas
CellFormula
C8=SUMPRODUCT((B2:B6="board")*(C2:C6))*1.2

<tbody>
</tbody>

<tbody>
</tbody>


Excel tables to the web >> Excel Jeanie HTML 4
see formla in c8 (why two screws??????)
 
Upvote 0

Forum statistics

Threads
1,215,063
Messages
6,122,927
Members
449,094
Latest member
teemeren

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