How do I return the most frequent occurrence of columns B and C values per each unique column A value? - indexing

Screen shot of google sheet trial
I have attached a screenshot of the data and want to find which is the vendors most frequent account and class.
I have tried different variations of Index, Match. and query, but don't seem to be getting anything but the number of total occurrences in the columns. I also tried =MODE.SNGL(IF(A$1:A$13=E3, B$1:B$13)) But it says "MODE cannot produce a result. No values occur more than once."

Related

Filtering and display unique column pairs in Excel

Follow on from Excel Count unique value multiple columns
I am trying to filter and setup a table containing all the unique combinations of message types.
So with three message types as an example below, I want to create a table with all the possible flows from this.
So every time MessageA exists, it is either followed by a MessageA, MessageB, MessageC or is the last of the sequence.
And everytime we see MessageC it is only followed by MessageA.
On the left, is the data and on the right is the desired result.
I want this to be able to scale to multiple columns/rows
You could do it by comparing two offset ranges, A1:D5 and B1:E5
=SUMPRODUCT(($A$1:$D$5=$G2)*($B$1:$E$5=K$1))
As you can see, I have cheated slightly by setting K1 blank so it compares correctly with column E, but this could be made part of a longer formula if it was necessary to have END as the column header for K.

Query that returns results that are at least a week apart

I have a google sheets spreadsheet that has lots of user data, timestamped. This data is entered into the google sheet by administration AND end users via a google form, so the data points don't come in at regular intervals. I want to be able to query against this datapool, but limit the results shown based a defined amount of time between result.
So say I wanted to query for Bob, I would get 3 results. Is it possible to query this data in a way that it would see the 11\11 result, but disregard the 11\12 result becuase it's within a week of the previous result? Really I'd like to be able to do this for any timeframe.
Well it's easy enough to do as an ordinary formula that you can pull down like this, but I don't see a way of doing it as a query or array formula:
=iferror(if(istext(F1),index(A$2:A,match(true,(B$2:B=$F$1),0)),index(A$2:A,match(1,(B$2:B=$F$1)*((A$2:A-F1)>=7),0))))
where the person's name is in F1.
This is a fairly rough outline of an answer, I haven't taken account of any time part of the timestamps. The last two dates are only separated by 6 days, but the formula includes the third to last and the last one as mentioned in my comment because they are separated by 7 days.

Using Excel to to Return unique values for Identical lookup values

I am attempting to use VLookup to match a "Purchase Number" to a specific "Invoice Number". To accomplish this, I have several identifiers about the purchase that I put together to come up with a special "Concat ID". I then have a list of Invoice Numbers that also has the same list of identifiers to create the same "Concat ID'.
The problem I am running into is that the set of identifiers is not unique (aka a purchase of 10 Computers might happen multiple times a year, therefore it is in my list multiple times). Because of this, when I use Vlookup to match the 2 IDs, it always is giving me the same Purchase Number for each time the Concat ID is found (which is just the first occurrence of that Concat ID).
Since there is no other data that would allow for matching (because Invoice date and purchase date are not always the same date or even close to one another), I am just wanting to ensure that each Invoice Number has a unique purchase number.
I'm not sure if its possible, but I was hoping I would be able to perform the vlookup then just skip to the next time the Concat ID is found, allowing for no duplicates, but that hasn't been feasible for me. Because this is a file of 16000 rows, any insight is very appreciated.
I'm sure that's not the clearest explanation, so I've attached a screenshot of the 2 examples in case anyone has any insight. I've been using a simple VLookup, but I'm open to trying VBA or any other suggestions everyone has. As always, thank you Stack community in advance for any help/insight!
Purchase Info
Attempted Matchup with Invoice Info
I'm still not sure what you expect to do with the ConcatID purchase number, but to return the purchase numbers that match your specific ConcatID, generated in the manner you describe in your question, and "skipping to the next" in the case of identical ConcatID's, you can do something like the following;
Note that I made a Table out of your original data, and am using structured references. This allows a much smaller amount of data to be processed compared with referencing the entire column, and will also autoadjust the range as you add/remove rows
Also note that if your Table starts in other than Row 1, you will need to make an adjustment in the formula to account for that.
G2: =INDEX(PurchaseTbl[#All],AGGREGATE(15,6,1/1/(PurchaseTbl[Concat ID]=F2)*ROW(PurchaseTbl),COUNTIF($F$1:F2,F2)),7)
and fill down as far as needed
I've got a really dorky solution, but maybe it will help.
Use this formula to create a unique ID for each row. It will count how many times the specific Concat ID has been used previously in the table, then append it to the end. You can use the Concat ID Unique in your VLookup to get the correct Purchase Number.
=D2 & "_" & (COUNTIF(D$1:D1, "=" & D2))

How to apply a single section across multiple columns in Business Intelligence

I do a lot of reporting out of our Electronic Health Record using a Business Objects product, and one thing I run into frequently is records for which most of the columns are the same, but a few may have multiple different values.
For instance, a report I'm working on has 8 columns, mostly static information about the patient/encounter, some lab values, and a column for the consulting physician. All the columns will have only a single value per patient/encounter, except for consulting physician which may have multiple. I'd like to somehow set the table to show only a single row for the data that is unchanged, so they don't end up seeing the FIN, MRN, and lab values over and over.
However, as far as I've been able to tell with my fiddling around, I can only apply a section or break to a single column. Creating multiple sections or breaks nests them. Does anybody know of a way to treat multiple columns as sort of a composite section?
edit: I did try pulling the consulting physician column out into its own table and then setting the room number as a section, but it still caused repeated rows of the other data for any that had multiple consultings.
Additional edit: As requested here's a mockup of approximately what I'd like to see. This is mostly how it looks already when I tell BO to use the room number (the number in blue, top left of each row) as a section, however in the case of the third room, it would repeat the information in the first 5 columns for each consulting listed.
Couple of ways to do it, but putting breaks on each column is what I would do.
So, starting from "FIN" and working to "Attending", add a break on each column. It will add a summary row for each, so it will look like:
Then select the summary rows, right-click, and Delete:

Find number of Unique Values per Item in Column B

I have a Column B with part numbers. These may repeat and can occur in the same warehouse, (Column A) and also different warehouses. I want to find the amount of times any particular part number appears in a unique warehouse.
I have tried a PivotTable and do not know if I need a macro or just a formula.
How might I achieve this?
Sorry, I think Remove Duplicates and Filter Advanced may not be your best bet. But as I understand your requirement a PT should suit: