Find total of col with varying lengths

csimonds

Board Regular
Joined
Oct 2, 2011
Messages
73
Hello Experts.
I have a question which I thought would be straight forward, but is proving quite difficult to solve. I have a monthly spreadsheet prepared by a 3rd party software package that I cannot alter. It returns in col A employee name, followed by product categories. In col. B it returns the value of sales for each of the product categories. As the end of each employee in col. B there is a subtotal. The trouble is col. A product categories vary, only categories with sales are shown. Therefore if an employee does not make a sale in one category it will not be displayed.

I need to be able to extract the employee name and total sale. I have tried various lookups/offset and index but have been unable to come to a workable solution. Would be more than happy for a formula or VBA solution. Any assistance would be greatly appreciated.

Thanks
Carolyn

Original Data Format

Data
Amount
M. Smith


Apple
20
Pear
20
Banana
40


80




P. Noone


Apple
10
Pear
10
Banana
10
Orange
20


50




C. Someone


Apple
20
Pear
20
Banana
20


60

<tbody>
</tbody>
 

Excel Facts

Do you hate GETPIVOTDATA?
Prevent GETPIVOTDATA. Select inside a PivotTable. In the Analyze tab of the ribbon, open the dropown next to Options and turn it off
Does each employee return multiple times within the output? What is the values you want returned according to above data?
Just: M. Smith - 80
P. Noone - 50
C. Someone - 60
???

It's not entirely clear what you want out of it for me.
 
Upvote 0
Hello Experts.
I have a question which I thought would be straight forward, but is proving quite difficult to solve. I have a monthly spreadsheet prepared by a 3rd party software package that I cannot alter. It returns in col A employee name, followed by product categories. In col. B it returns the value of sales for each of the product categories. As the end of each employee in col. B there is a subtotal. The trouble is col. A product categories vary, only categories with sales are shown. Therefore if an employee does not make a sale in one category it will not be displayed.

I need to be able to extract the employee name and total sale. I have tried various lookups/offset and index but have been unable to come to a workable solution. Would be more than happy for a formula or VBA solution. Any assistance would be greatly appreciated.

Thanks
Carolyn

[...]


DataAmount EmployeeTotal
M. Smith M. Smith80
Apple20 P. Noone50
Pear20 C. Someone60
Banana40
80
P. Noone
Apple10
Pear10
Banana10
Orange20
50
C. Someone
Apple20
Pear20
Banana20
60

<COLGROUP><COL style="WIDTH: 93pt; mso-width-source: userset; mso-width-alt: 4408" width=124><COL style="WIDTH: 94pt; mso-width-source: userset; mso-width-alt: 4465" width=126><COL style="WIDTH: 48pt" width=64><COL style="WIDTH: 94pt; mso-width-source: userset; mso-width-alt: 4465" width=126><COL style="WIDTH: 58pt; mso-width-source: userset; mso-width-alt: 2759" width=78><TBODY>
</TBODY>

Data is located in A2:B19, the header row excluded.

D2, control+shift+enter, not just enter, and copy down:
Rich (BB code):
=IFERROR(INDEX($A$2:$A$19,SMALL(IF(1-($A$2:$A$19=""),
  IF(1-ISNUMBER($B$2:$B$19),ROW($A$2:$A$19)-ROW($A$2)+1)),
  ROWS($D$2:D2))),"")

E2, control+shift+enter, not just enter, and copy down:
Rich (BB code):
=IF($D2="","",INDEX($B$2:$B$19,SMALL(IF($A$2:$A$19="",
  IF(ISNUMBER($B$2:$B$19),ROW($A$2:$A$19)-ROW($A$2)+1)),
  ROWS($E$2:E2))))
 
Upvote 0
Hi Aladin,

Thank you very much for taking the time to reply. Your formula works perfectly.
Thank you!
 
Upvote 0

Forum statistics

Threads
1,216,101
Messages
6,128,845
Members
449,471
Latest member
lachbee

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