Marking "Ambidextrous" in Excel - excel

This is an example that illustrates my problem
So I have a table of participants, each with their own unique ID number. They all do a writing test and their time, in minutes, is recorded in the fourth column as an integer. Some patients have repeated the test, there is no maximum number of repeats.
+============+===========+===============+======+
| Patient ID | Hand Used | Ambidextrous? | Time |
+============+===========+===============+======+
| 01 | Right | Yes | 12 |
+------------+-----------+---------------+------+
| 01 | Right | Yes | 10 |
+------------+-----------+---------------+------+
| 01 | Right | Yes | 11 |
+------------+-----------+---------------+------+
| 01 | Left | Yes | 13 |
+------------+-----------+---------------+------+
| 01 | Right | Yes | 12 |
+------------+-----------+---------------+------+
| 02 | Right | No | 9 |
+------------+-----------+---------------+------+
| 02 | Right | No | 7 |
+------------+-----------+---------------+------+
| 02 | Right | No | 8 |
+------------+-----------+---------------+------+
| 03 | Left | Yes | 8 |
+------------+-----------+---------------+------+
| 03 | Right | Yes | 8 |
+------------+-----------+---------------+------+
I want the "Ambidextrous?" column to be a formula. I've been trying to accomplish this with INDEX() and MATCH(), to no avail. It needs to check the "Hand Used" column, if there is both a Right handed and Left handed test for a particular Patient ID, we say "Yes".

Use:
=IF(COUNTIFS(A:A,A2,B:B,IF(B2="Right","Left","Right")),"Yes","No")

Related

How to join tables creating a new row if it doesn't exist

How to join tables creating a new row if it doesn't exist.
I tried: Products.join(Class, Products.id_product == Class.id_product, 'right')
Products
+-----------+-------+----------+-----------+
|day | store | quantity | id_product|
|2022-05-05 | 01 | 10 | 1 |
|2022-05-05 | 01 | 10 | 2 |
|2022-05-05 | 01 | 7 | 3 |
|2022-05-22 | 01 | 8 | 1 |
+-----------+-------+----------+-----------+
Class
+-----------+-----+
|id_product | size|
|1 | S |
|2 | L |
|3 | XL |
+-----------+-----+
I would like new rows to be created with null value for quantity of stock, but keeping the information of day, store, id_product and size.
My result
+-----------+-------+----------+------------+-----+
|day | store | quantity | id_product | size|
|2022-05-05 | 01 | 10 | 1 | S |
|2022-05-05 | 01 | 10 | 2 | L |
|2022-05-05 | 01 | 7 | 3 | XL |
|2022-05-22 | 01 | 8 | 1 | S |
+-----------+-------+----------+------------+-----+
Expected
+-----------+-------+----------+------------+-----+
|day | store | quantity | id_product | size|
|2022-05-05 | 01 | 10 | 1 | S |
|2022-05-05 | 01 | 10 | 2 | L |
|2022-05-05 | 01 | 7 | 3 | XL |
|2022-05-22 | 01 | 8 | 1 | S |
|2022-05-22 | 01 | null | 2 | L |
|2022-05-22 | 01 | null | 3 | XL |
+-----------+-------+----------+------------+-----+
Guess you need to first have all combinations of day, store, product and size and then outer join with products.
products
.select($"day", $"store")
.distinct
.crossJoin(classes)
.as("keys")
.join(
products.as("prds"),
Seq("day", "store", "id_product"),
"left"
)
.select(
$"keys.day", $"keys.store", $"prds.quantity",
$"keys.id_product", $"keys.size"
)

Can you select the MIN row to display across all "Results Grid" values? (Generic Inquiry)

I have the following tables:
(Example data)
PMProjects
| ContractID | ContractCD | Customer |
| :-------- | :----------| :------- |
| 01 | PR00001 | ABC-Customer |
| 02 | PR00002 | XYZ-Customer |
PMTasks
| Task ID | Project ID| Task CD | Description |
| :--------| :---------| :---------| :-------- |
| 39 | 01 | 01 First | Zulu |
| 40 | 01 | 02 Second | Foxtrot |
| 41 | 01 | 03 Third | Delta |
| 42 | 01 | 04 Fourth | Alpha |
| 55 | 02 | 01 First | Zulu |
| 56 | 02 | 02 Second | Foxtrot |
| 57 | 02 | 03 Third | Delta |
| 58 | 02 | 04 Fourth | Alpha |
I have successfully joined PMTasks to PMProjects on PMProjects.ContractID = PMTasks.ProjectID.
And, I am grouping by PMProjects.ContractID
On the GI, I need to display the MIN TaskID row for each Project.
My GI - Aggregate Functions by MIN value
Result -
When I use the MIN value on the PMTasks.Description field it pulls the value "Alpha".
GI Results
| ContractID | ContractCD | Customer | Task ID | Task CD | Description |
| :--------- | :--------- | :----------- | :------- | :-------- | :---------- |
| 01 | PR00001 | ABC-Customer | 39 | 01 First | Alpha |
| 02 | PR00002 | XYZ-Customer | 55 | 01 First | Alpha |
Documentation - Aggregate Function Descriptions
I see from the documentation that the MIN aggregate function, "Returns the minimum value of all values of the group."
Has anyone found a way to join many-to-one in an Acumatica Generic Inquiry using the MIN (or MAX) value of a row?
Or to put it a different way - has anyone found a way to join one of many rows to a table and have the results grid display only the values from the same row?
I hope this makes sense. Please feel free to ask any clarification questions.
Thanks for any and all feedback.
Example GI related to the question. Please excuse the error under Results Grid - PMProjects.CustomerCD_Description does not need to be aggregated.
You need to add a group by PMContract.ContractID and then add the Min() function in the Data Field

How to get and concatenate values from one column based on another column in Excel

Excel is beating me up for a day here.
I have this table:
+---+--------+--------+--------+--------+
| | A | B | C | D |
+---+--------+--------+--------+--------+
| 1 | AGE | EX# | DG1 | DG2 |
+---+--------+--------+--------+--------+
| 2 | 19 | C01 | ASC | |
+---+--------+--------+--------+--------+
| 3 | 45 | C02 | ATR | |
+---+--------+--------+--------+--------+
| 4 | 27 | C03 | LSI | |
+---+--------+--------+--------+--------+
| 5 | 15 | C04 | LSI | |
+---+--------+--------+--------+--------+
| 6 | 49 | C05 | ASC | AGC |
+---+--------+--------+--------+--------+
| 7 | 76 | C06 | AGC | |
+---+--------+--------+--------+--------+
| 8 | 33 | C07 | ASC | |
+---+--------+--------+--------+--------+
| 9 | 17 | C08 | LSI | |
+---+--------+--------+--------+--------+
Now, I need to create a new table based on that data, with one row and one column, which I'll fill column A and need a formula to fill column B:
+----+--------+---------------+
| | A | B |
+--=-+--------+---------------+
| | DG | AGE |
+--=-+--------+---------------+
| 10 | AGC | 49, 76 |
+----+--------+---------------+
| 11 | ASC | 19, 33, 49 |
+----+--------+---------------+
| 12 | ATR | 45 |
+----+--------+---------------+
| 13 | LSI | 15, 17, 27 |
+----+--------+---------------+
So I need a formula to check the first table's columns C and D for each DGs, and check the age of each one in column A, and then concatenate all values that match into one cell with a , as a separator.
Can anyone help me?
Thanks
On the great excel website from Chip Pierson, I found the custom function: StringConcat. Just copy-paste the code in a VBA module.
Something like the following formula (in cell B10 & fill down)should work for you. It's an array formula (commit with [ctrl-shift-enter]
=StringConcat(", ",IF(Sheet1!$B$2:$C$100=A10,Sheet1!$A$2:$A$100,""))
You'll have to adjust the ranges off course.

Excel: sort column with mixed numbers and letters?

I am working of the dataset in Excel that I obtained from an experiment. Since I needed some ratings (and I wanted the raters to be blind) I completely randomized the answers and now I can't put them back in order!
This is what I have:
1A
38R
22R
7A
41R
64A
etc...
And this is what I need in the end:
1A
2A
3A
...
99R
100R
101R
Thank you!
I have created two new columns (B and C in this case, as in the other example posted).
I have typed LEFT(A1,LEN(A1)-1) in column B to get the number; then =RIGHT(A1,1) in column C to get the letter; finally I can sort by B and C.
You will not get your desired output by sorting alphabetically, because 100R would come before 2A.
If your values will always be in the format of a number followed by a single character and will be at most 5 characters long, you can use #Scott Craner's formula =RIGHT("00000"&A1,5) to pad the left of your value with "0" so that you can alphabetize correctly. 100R will become 0100R. 2A will become 0002A. These will now alphabetize correctly.
Now you can simply sort your range by column B ascending alphabetically.
If you need more characters, just add as many zeroes as characters to the formula, and change the 5 in the formula to your new number of characters.
Here is an example excel file.
INPUT
+---+-----+-------+
| | A | B |
+---+-----+-------+
| 1 | 1A | 0001A |
+---+-----+-------+
| 2 | 38R | 0038R |
+---+-----+-------+
| 3 | 22R | 0022R |
+---+-----+-------+
| 4 | 7A | 0007A |
+---+-----+-------+
| 5 | 41R | 0041R |
+---+-----+-------+
| 6 | 64A | 0064A |
+---+-----+-------+
RESULT
+---+-----+-------+
| | A | B |
+---+-----+-------+
| 1 | 1A | 0001A |
+---+-----+-------+
| 2 | 7A | 0007A |
+---+-----+-------+
| 3 | 22R | 0022R |
+---+-----+-------+
| 4 | 38R | 0038R |
+---+-----+-------+
| 5 | 41R | 0041R |
+---+-----+-------+
| 6 | 64A | 0064A |
+---+-----+-------+

Count text occurrences in a column in Excel

I have the following list in Excel:
+-------+----------+
| am | ipiresia |
+-------+----------+
| 50470 | 29 |
| 50470 | 43 |
| 50433 | 29 |
| 6417 | 51 |
| 6417 | 52 |
| 6417 | 53 |
| 4960 | 25 |
| 4960 | 26 |
| 5567 | 89 |
| 6716 | 88 |
+-------+----------+
I want to add a column, let's say 'num' and count the occurrences of column 'am' in a row adding one when a new occurrence happens as follows:
+-------+----------+-----+
| am | ipiresia | num |
+-------+----------+-----+
| 50470 | 29 | 1 |
| 50470 | 43 | 2 |
| 50433 | 29 | 1 |
| 6417 | 51 | 1 |
| 6417 | 52 | 2 |
| 6417 | 53 | 3 |
| 4960 | 25 | 1 |
| 4960 | 26 | 2 |
| 5567 | 89 | 1 |
| 6716 | 88 | 1 |
+-------+----------+-----+
Is it possible to get this automatically with a formula in Excel?
yes,
my example:
(assume you start your table containing 3 columns at Excels origin at A1 without header lines)
Then fill C1 with value "1"
and then start in C2 with entering a formula
simple like this:
=if($A2=$A1;$C1+1;1)
then you drag C2 down at the cells downright located autofill position as far as you want. Most times also double click works to let Excel autofill the columns down to the end of you prefilled table.
If you need assistance for AutoFill press F1 in Excel an the help with tell you in detail.
Assuming the sample table starts at A1 (with headers) the following formula will provide the expected results even if the list is not sorted.
=COUNTIF($A$1:$A2,A2)
Enter the formula at cell C2 then paste it down to the last cell of the data (or use AutoFill)

Resources