How to get two+ rows to link together? Excel 2010 (Example) - excel

I have a parts list with competitor pricing. One part number brings multiple brands up with the location of the company.
As you can see from the picture, I have part numbers for one item with three companies. I want to sort by part type. So for example I want to list only the brake pads. When I do this the blanks get sent to the bottom, but the blanks are not really blanks because they have additional info with them for that part number.
Column 1 | Column 2 | Column 3 | Column 4 | Column 5 | Column 6 | Column 7
Part No | Company A | Price | Company B | Price | Company C | Price
4656546 | Brand A | $5 | Brand A | $5 | Brand A | $5
(BLANK) | Brand b | $8 | Brand b | $8 | Brand b | $8
I have tried to use a helper column, but I have 1,000+ rows.
Does anyone know if you can link or have a relationship between two+ rows?
I hope you understand and if not. I can try to explain better.

I asume that a "blank" in PartNo means "take the PartNo from the cell above" ...
In order to normalize the PartNo (= get rid of the blanks) use another PartNo-Normalized column (e.g. [K:K]) and normalize as following:
K1 ="PartNo-Normalized"
K2:Kxx =IF(A2<>"",A2,K1)
Next convert all formulas in [K:K] into values !!! (Copy / PasteAs - Values) before sorting ... as a sort operation will destroy the calculated values.
After conversion to values it's save to sort, and you may create a filter on that column.
Depending on how well organized your data is, it might be a good idea to add one more column and fill it with 1, 2, 3, 4, 5 ... before any sorting so you can restore the original sort order just in case something nasty happens.

Related

Excel Sumproduct/Sumif based on multiple criteria across two tables not in order

I've been struggling with an issue for a while now and haven't been able to find a solution, so any help would be greatly appreciated!
I'm trying to build a formula that sums up values from a column based on criteria spread across two tables (I've simplified below):
Table 1
+-------------+---------+---------------------+------------+----------+------+
| Customer ID | Twin ID | Customer Entry Date | Exit Date | Spending | Days |
+-------------+---------+---------------------+------------+----------+------+
| 111 | 333 | 24.12.2015 | 28.05.2018 | 5000 | 200 |
| 222 | 444 | 19.06.2014 | | 4000 | 300 |
+-------------+---------+---------------------+------------+----------+------+
Table 2
+-------------+---------+---------------------+-----------+----------+------+
| Customer ID | Twin ID | Customer Entry Date | Exit Date | Spending | Days |
+-------------+---------+---------------------+-----------+----------+------+
| 444 | | | | | 200 |
| 333 | | | | | 0 |
+-------------+---------+---------------------+-----------+----------+------+
I now need to find a formula, that will allow me to sum up the column "Spending" from table 1 based on the following criteria:
"Twin ID" in Table 1 is not empty and the value matches the value "Customer ID" in Table 2 --> this has been the main complication for me, as the Customer IDs in Table 2 are in a different order than the Twin IDs in Table 1
"Entry Date" in Table 1 is < a specific date
"Exit Date" in Table 1 is >= a specific date or empty
"Days" in Table 2 is >0 (for the respective Customer ID that matches the Twin ID from Table 1)
Or in other words: "If customers 111,222 etc. have a twin, and this twin has days >0, and the entry and exit dates of the customer are < > a specific date or empty, then sum up the spending of those customers"
I've tried various iterations of the SUMPRODUCT formula, and this one currently works as long as the two tables are in the same order (i. e. Twin ID "333" is in row 2 in Table 1 and in row 2 in Table 2):
=SUMPRODUCT(--(Table1!Customer Entry Date<DATE1);--(Table1!Exit Date>=Date2);--(Table1!TwinID<>"");--(Table2!Days>0);Table1!Spending)
Is there any way to make this formula work regardless of the order of the row items (i. e. Twin ID "333" is in row 2 in Table 1 and in row 3 in Table 2)?
Any help would be greatly appreciated!
Try this
=SUMPRODUCT((Table1!Customer_Entry_Date<Date1)*(Table1!Customer_Entry_Date>Date2)*(Table1!Twin_ID<>"")*(COUNTIFS(Table2!Customer_ID,Table1!Twin_ID,Table2!Days,">0")>0)*Table1!Spending)
It's similar to your formula, but uses Countifs to see if a matching Customer ID for Table 1's Twin ID is anywhere in table 2.
Note that your named ranges (if that's what you're using) should not include the column headers or else you'll get a #Value error when it tries to do the multiplication.
You could avoid it by putting IF(Isnumber()) around the last part of the bracket, but then it would have to be entered as an array formula
=SUM((Table1!Customer_Entry_Date<Date1)*(Table1!Customer_Entry_Date>Date2)*(Table1!Twin_ID<>"")*(COUNTIFS(Table2!Customer_ID,Table1!Twin_ID,Table2!Days,">0")>0)*IF(ISNUMBER(Table1!Spending),Table1!Spending))
I managed to solve the issue.
Anyone facing a similar problem, please see the example file for solution: https://wetransfer.com/downloads/90aedc5943f52274e36102a79e23c18e20180628212338/2fd1c1
=+SUMPRODUCT(SUMIF(Table1TwinID;Table2CustomerID;Table1Spending)*(Table2Days>0)*((COUNTIFS(Table1TwinID;Table2CustomerID;Table1EntryDate;"<"&DATE1)*COUNTIFS(Table1TwinID;Table2CustomerID;Table1ExitDate;">="&DATE2))+(COUNTIFS(Table1TwinID;Table2CustomerID;Table1EntryDate;"<"&DATE1)*COUNTIFS(Table1TwinID;Table2CustomerID;Table1ExitDate;""))))

How to extract multiple rows that meet a criteria which is given by 2 drop-down lists in EXCEL

I have a sheet that looks like this:
A | B | C | D | E | F
1 NAME | TASK | ADRESS | ORDER_GIVER | COUNT | NOTE
2 DROPDOWN_2 | move | NY, xy_street | Ann | 1 | ...
3 DROPDOWN_2 | fill | CA, yx_street | Rose | 3 | ...
...
100 NAME | TASK | ADRESS | ORDER_GIVER | COUNT | NOTE
101 DROPDOWN_1
102
103 NAME | TASK | ADRESS | ORDER_GIVER | COUNT | NOTE
104 DROPDOWN_1
INITIALLY:
In rows 1-99 you find the tasks with 1 column empty (NAME).
In rows 100+ you find "Tickets" which can be printed (2 rows for example 100-101)
THEN
1, The ORGANISER (me) makes tickets with names, by ctrl+c/ctrl+v the "ticket structure" and by choosing a name from the DROPDOWN_1 list.
2, Then starts to assign the tasks (row 1-99) to people by choosing them from the DROPDOWN_2 list. (note that dropdown name lists contain the same names.)
After this I would like to have the Excel to fill in the tickets by the rows that contain the same name as the ticket. One person can be assigned to more tasks, but one task can only be assigned to one man. (So tickets can have 1 NAME but more rows depending on the 1-99 list.
I am asking you to help me make a formula or function for this "autofill" of tickets because I have been searching for days for a solution however couldn't find a proper one.
In the Similar problems and solutions section you can find 2 links which had the closest answer. Unfortunately neither of them contain dropdown lists. I tried to solve the problem with INDEX(MATCH()) functions, but the problem is that it cannot handle the changes of names.
Thanks you,
Max
Similar problems and solutions:
https://www.get-digital-help.com/2009/09/28/extract-all-rows-from-a-range-that-meet-criteria-in-one-column-in-excel/
Extracting all rows based on a value of cell without VBA
Select A101:F392 and enter this as an array formula (ctrl+shift+enter):
=IFERROR(INDEX(A1:F99,ROUND(MOD(SMALL(IFERROR(CHOOSE({1,2},SMALL(IFERROR(1/(1/MMULT(IF(SMALL(COUNTIF(A2:A99,"<="&A2:A99),ROW(INDIRECT("2:98")))=SMALL(COUNTIF(A2:A99,"<="&A2:A99),ROW(INDIRECT("1:97"))),0,ROW(A2:A98)),{1,1}))+{0.001,-0.001},FALSE),ROW(INDIRECT("1:196"))),COUNTIF(A2:A99,"<="&A2:A99)+ROW(A2:A99)/1000),FALSE),ROW(INDIRECT("1:292"))),1)*1000,0),{1,2,3,4,5,6}),"")

Counting the number of older siblings in an Excel spreadsheet

I have a longitudinal spreadsheet of adolescent growth.
ID | CollectionDate | DOB | MOTHER ID | Sex
1 | 1Aug03 | 3Apr90 | 12 | 1
1 | 4Sept04 | 3Apr90 | 12 | 1
1 | 1Sept05 | 3Apr90 | 12 | 1
2 | 1Aug03 | 21Dec91 | 12 | 0
2 | 4Sept04 | 21Dec91 | 12 | 0
2 | 1Sept05 | 21Dec91 | 12 | 0
3 | 1Aug03 | 30Jan89 | 23 | 0
3 | 4Sept04 | 30Jan89 | 23 | 0
This is a sample of how my data is formatted and some of the variables that I have. As you can see, since it is longitudinal, each individual has multiple measurements. In the actual database there are over 10 measurements per individual and over 250 individuals.
What I am wanting to do is input a value signifying the number of older brothers and older sisters each individual has. That is why I have included the Mother ID (because it represents genetic relatedness) and sex. These new variable columns would just say how many older siblings of each sex each individual has. Is there a formula that I could use to do this quickly?
=COUNTIFS($B:$B,"<>"&$B2,$H:$H,$H2,$AI:$AI,$AI2,$J:$J,"<"&$J2)
Create a column named Distinct with this formula
=1/COUNTIF([ID],[#ID])
Then you can find all the older 0-sexed siblings like this
=SUMPRODUCT(([DOB]>[#DOB])*([MOTHERID]=[#MOTHERID])*([Sex]=0)*([Distinct]))
Note that I made the data a Table and used table notation. If you're not familiar [COLUMNNAME] refers to the whole column and [#COLUMNNAME] refers to the value in that column on the current row. It's similar to saying $A:$A and A2 if you're dealing with column A.
The first formula gives you a value to count that will always result in 1 for a particular ID. So ID=1 has three lines and Distinct will result in .33333 for each line. When you add up the three lines you get 1. This is similar to a SELECT DISTINCT in Sql parlance.
The SUMPRODUCT formula sums [Distinct] for every row where the DOB is greater than the current DOB, the Mother is the same as the current Mother, and the Sex is zero.
I have a possible solution. It involves adding two columns -- One for "# older siblings" and one for "unique?". So here are all the headings I have currently:
A -- ID
B -- CollectionDate
C -- DOB
D -- MOTHER ID
E -- Sex
F -- # older siblings
G -- unique?
In G2, I added the following formula:
=IF(A2=A1,0,1)
And dragged down. As long as the data is sorted by ID, this will only display "1" once for each unique person.
In F2, I added the following formula:
=COUNTIFS(G:G,"=1",D:D,"="&D2,C:C,"<"&C2)
And dragged down. It seemed to work correctly for the sample data you provided.
The stipulations are:
You would need the two columns.
The data would need to be sorted by ID
I hope this helps.
You need a formula like this (for example, for row 2):
=COUNTIFS($A:$A,"<>"&$A2,$E:$E,$E2,$D:$D,$D2,$C:$C,"<"&$C2)
Assuming E:E is column for sex, D:D is column for mother ID and C:C is column for DOB.
Write this formula in H2 cell for example and drag it down.

Count number of rows where multiple criteria are met

I'm trying to generate a table that shows a count of how many items are in any given status on any given day. My result table has a set of Dates down column A and column headers are various statuses. A sample of my data table with headers looks like this:
Product | Notice | Assigned | Complete | In Office | In Accounting
1 | 5/5/13 | 5/7/13 | 5/9/13 | 5/10/13 | 5/11/13
2 | 5/5/13 | 5/6/13 | 5/8/13 | 5/9/13 | 5/10/13
3 | 5/6/13 | 5/9/13 | 5/10/13 | 5/10/13 | 5/10/13
4 | 5/4/13 | 5/5/13 | 5/7/13 | 5/8/13 | 5/9/13
5 | 5/7/13 | 5/8/13 | 5/10/13 | 5/11/13 | 5/11/13
If my output table were to contain a set of dates in the first column with the statuses as headers, I need a count of how many rows were at the given status and had not yet transitioned to the next status so that in the Notice column, I'd have a count of rows where the Notice Date was <= X AND where the Assigned, Complete, In Office, In Accounting are all greater than X.
I've used a Sum(if(frequency(if statement to get me REALLY close but I feel like I need to have an AND statement within the second IF like this =SUM(IF(FREQUENCY(IF(AND
Here's what I have that won't work:
=SUM(IF(FREQUENCY(IF(AND(Table1[Assigned]<=A279,Table1[[Complete]:[In Accounting]]<=A279),ROW(Table1[[Complete]:[In Accounting]])),ROW(Table1[[Complete]:[In Accounting]]))>0,1))
If I take the "AND" portion out, this works fine except I need it to ONLY count rows where the given status actually has a date so if an "Assigned" date is empty, I don't want that row to be counted for the Assigned column.
Here's an example of what I'd expect to see in the results. I've listed the count in the each column as well as the corresponding product numbers in parenthesis. The corresponding product numbers are for reference only and won't actually be in the result table.
Date | Notice | Assigned | Complete
5/6 | 2 (1,3) | 2 (2,4) | 0
5/7 | 2 (3,5) | 2 (1,2) | 1 (4)
5/8 | 1 (3) | 2 (1,5) | 1 (2)
OK, assuming you have the original data in A1:F6 then with 2nd table headers in B9:D9 and row labels in A10:A12 then you can use this "array formula" in B10
=SUM((B$2:B$6<=$A10)*(MMULT((C$2:$F$6>$A10)+(C$2:$F$6=""),TRANSPOSE(COLUMN(C$2:$F$6)^0))=COLUMNS(C$2:$F$6)))
confirmed with CTRL+SHIFT+ENTER and copied down and across (see screenshot below)
As you can see the results are as per your requirement. If you replace dates with blanks it will still work
MMULTis a way to get a single value from each row even when you are looking at multiple columns.
I used cell references because I think that's easier, especially when copying the formula across and having a reducing range.......but you can use structured references if you want
Have you tried using COUNTIFS to count based on multiple criteria. It is fairly well documented here: http://office.microsoft.com/en-us/excel-help/countifs-function-HA010047494.aspx (2007+ only)
Basically, you use it like
=COUNTIFS(first_range_to_check, value_you_want_in_first_range, ...)
where the ... represents as many pairs as you want (up to 127 total pairs), note the conditions are AND connection so if you have two pairs, the first pair AND the second pair must return true for that row to count.

Compare values in the same row in a Lotus Notes view

I want to create a calculated column that returns YES if the four columns beside it are not null and NO if they are all null. An example would be this:
Calculated Column| Column 1 | Column 2 | Column 3 | Column 4 |
YES | 10 | 5 | 3 | 2 |
YES | | 3 | | |
NO | | | | |
I'm not sure how to compare values in the same row though. If I check for something like "Column1 = '' " it check the whole column, rather than just the individual row.
I think you have the correct idea. In your calculated column, you can check the values of columns 1 - 4. The check will be performed for each row.
So assuming you had fields 1 through 4 that were the formulas for columns 1 through 4, your calculated column would look like this:
#If(#Length(field1 + field2 + field3 + field4) > 0; "YES"; "NO");
Are you using the "programmatic name" property of the columns to refer to them in your formula? If so, have you changed them from the default values of $1, $2, $3, etc? You actually can't use these default values in Notes formula language.
Note that as suggested in Ken's answer, it's also possible (and frankly, much more common) to refer to the field names from the underlying document in your formula, rather than the programmatic names of columns. If your colunns 1 thru 4 are also calculated, however, using the programmatic names is reasonable.

Resources