Is it possible to calculate values based on length of field?

masplin

Active Member
Joined
May 10, 2010
Messages
413
I have a table of invoices in which a customer may appear 5 times. They may have their name as "K Smith" or "Kate Smith". I have a "customer" table and trying to filter values from the invoice table using this sort of function
Code:
=CALCULATE(VALUES(Invoices[Full Name]),filter(Invoices,Invoices[Unique Customer Code]=Customers[Unique Customer Code]))
Obviously this throws an error that a table of multiple values has been supplied.

for dates you can use a MIN or MAX function to pick out one date where there are multiple values.

Is there any way to pick out the longest entry where there are multiple values so the above would return "Kate Smith"? Generally it seems in my data the longer the entry the better it is.

Thanks for any advice

Mike
 
For what it is worth i managed ot construct a single measure by using the RANKX function on the LEN(column name) where rank =1. However after 4 hours calculating and using 15GB of RAM I gave up. 160,000 rows with 80,000 unique customers was just too much!!!! If any one has an intelligent idea that would be great, but for time being I think I create a RANKX function for each field (which has the advantage of being to deal with ones the same length).
 
Upvote 0

Excel Facts

Save Often
If you start asking yourself if now is a good time to save your Excel workbook, the answer is Yes
This was my solution that didnt work

=IFERROR(
CALCULATE(
VALUES(Invoices[Unique Customer Code]),
filter(
Invoices,
RANKX(
FILTER(
invoices,
Vehicles[Reg Num Clean]=Invoices[Reg Num Clean]
),
Invoices[Unique Customer Code],,1
)=1
)
),
blank()
)
 
Upvote 0
is there any way that you can upload a copy of the workbook? it's hard for me to imagine how your table looks right now and the values that go with each column
 
Upvote 0

Forum statistics

Threads
1,224,988
Messages
6,182,186
Members
453,093
Latest member
Soffy

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