Build a table or array based on unqiue values in 2 columns

gers1978

Board Regular
Joined
Sep 9, 2014
Messages
74
I have some code that creates a pivot table based on a worksheet.

One of the columns is a person's selling rate, another has their name, another has hours worked. The pivot table end up grouping them by name, with their selling rate multiplied by their hours.

Problem is, sometimes someone's selling rate has changed during the year. My problem is then that the pivot table still sees this as one person, and either sums, averages or takes a max of their selling rate.

What I would like to do is perhaps append " (old rate)" to their name if there's a change in selling rate so that when the pivot table is created it sees this as two people and doesn't average/sum/max their selling rate.

As an example, say my source sheet has:

Smith, John | 10 | £10.00
Smith, John | 20 | £10.00

The pivot table would correctly group this to:

Smith, John | 30 | £300.00

However if John Smith's selling rate changed to £15 during the year, my source sheet might say:

Smith, John | 10 | £15.00
Smith, John | 20 | £10.00

In which case, currently, my pivot table (incorrectly) end s up with:

Smith, John | 30 | £350.00

What I'd like to see is:

Smith, John | 10 | £150
Smith, John (old rate) | 20 | £200

Thanks!

Also posted here:

http://www.ozgrid.com/forum/showthread.php?t=200192&p=772680#post772680
 
Last edited:

Excel Facts

Remove leading & trailing spaces
Save as CSV to remove all leading and trailing spaces. It is faster than using TRIM().
Can you add a date field to distinguish a specific entry?

There's plenty fields I can I use to differentiate (in fact I can use the selling rate itself), my problem is I don't know how/where to make the differentiation.
 
Last edited:
Upvote 0
If it the rate changes each day, then I would use a day field. If it change during a given day, I would use a time field (hr/min). That should differentiate a specific rate. Any field making it unique will essentially work
 
Upvote 0
If it the rate changes each day, then I would use a day field. If it change during a given day, I would use a time field (hr/min). That should differentiate a specific rate. Any field making it unique will essentially work

Change it WHERE though?
 
Upvote 0
If the rate changes at a specific point in time use the time function (hr/min. If it changes each date use a regular day. Both each are specifically unique when they are converted to a number format. So use either date or time function for a specific rate occurance (transaction). Hope this helps??


Excel 2012
ABCDE
10.5208412:30 PM425386/17/2016
20.5215412:31 PM425396/18/2016
Sheet1
Cell Formulas
RangeFormula
A1=TIME(12,30,1)
B1=TIME(12,30,1)
 
Upvote 0

Forum statistics

Threads
1,214,641
Messages
6,120,691
Members
448,978
Latest member
rrauni

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