Get instances of rows in excel for a particular group [duplicate] - excel

This question already has answers here:
Excel - order of occurrence / running total formula
(2 answers)
Closed 18 days ago.
I have dataset containing list of checks numbers.
Check
111
111
111
222
222
I am trying to have a new column in my dataset which would give me 1st, 2nd, ....nth instance for every check. The output would like something as below,
Check
Instance
111
1
111
2
111
3
222
1
222
2

To create a rolling count for a specific instance that appears in a range of cells, you can use the COUNTIF function with an expanding range.
=COUNTIF(A$2:A2,A2)

Related

Excel get info about maximum value in a variable defined range [duplicate]

This question already has answers here:
Vlookup using 2 columns to reference another
(2 answers)
Closed 6 months ago.
assume I have the following set of data :
ID CAT VAL
a a 4
b a 94
c b 5
d b 94
e c 2
f c 3
In Excel 2019 Pro get the maximum VAL of CAT=b using MAXIF(VAL,CAT=b) and I get 94. Now I want to get the ID of the corresponding value (i.e. ID=d), but I cannot use INDEX+MATCH since the maximum of CAT=a is also 94 and then I get ID=b which is not what I want.
How to get around that??
Thanks, many of them.
if you have Excel 365 you can use this formula:
=INDEX(SORT(FILTER(A2:C7,B2:B7="b"),3,-1),1,1)
It first filters all CAT = B rows.
Sorts them by column VAL Descending --> the highest VAL-row is at the top
Then returns via INDEX the first column of the first row.

Sumif of multiple Index matches against one value

Need help regarding Excel dynamically search based sum of two columns matching from two different tables.
I have got this Table of Data Entered One Time
A B C
1 Qlty Warp Weft
2 Stpl.1 150 20
3 Cotn.1 80 60
4 Stpl.2 20 20
5 Cotn.2 20 20
6 Stpl.3 20 40
in Column A2:A6, Quality can not be duplicated, its a unique Name
The Data entry and report Table is here
A B C D E F
8 Yarn Name Sent Bags Remaining Qualty Used Warp Used Weft
9 20 800 600 Stpl.1 71 200
10 150 101 30 Stpl.2 70 30
11 40 300 290 Stpl.3 100 10
12 20 400
C9:C5000 is Returning Column, Values are calculated on the base of Column A9:A5000 (Yarn Name)
Need to Find Yarn Name (eg:) "20" in B2:B6 AND/OR C2:C6, wherever it matches, index that Quality from A2:A6
Then match the returned qualities(could be more than one) to D9:D5000 and sum the mathced results from E9:F5000
I have tried so far in C12
=SUMIF($A$9:$A12,A12,$B$9:$B12)-(SUMIF($D$9:$D12,INDEX($A$2:$A$6,MATCH(A12,$B$2:$B$6,0)),$D$9:$D12)+SUMIF($D$9:$D12,INDEX($A$2:$A$6,MATCH(A12,$C$2:$C$6,0)),$D$9:$D12))
PS:- I am using Excel 2007
If I understand correctly, then following array formula can help you:
=SUM(IFERROR(INDEX($A$2:$A$6,N(IF(1,(MMULT(--($B$2:$C$6=A9),TRANSPOSE(COLUMN($B$2:$C$6)^0))>0)*(ROW($B$2:$C$6))-1)))=TRANSPOSE($D$9:$D$12),0)*TRANSPOSE($E$9:$E$12+$F$9:$F$12))
Array formula after editing is confirmed by pressing ctrl + shift + enter
Edit:
To calculate Warp and Weft columns separately use following array formula:
=SUM(IFERROR(INDEX($A$2:$A$6,N(IF(1,((A9=$B$2:$B$6)*ROW($B$2:$B$6))-1)))=TRANSPOSE($D$9:$D$12),0)*TRANSPOSE($E$9:$E$12))+SUM(IFERROR(INDEX($A$2:$A$6,N(IF(1,((A9=$C$2:$C$6)*ROW($C$2:$C$6))-1)))=TRANSPOSE($D$9:$D$12),0)*TRANSPOSE($F$9:$F$12))

Excel sum based on lookup of code and values in another table

Given 2 named tables in Excel 2013 (or higher):
tblInvoice
ID InvRef Total
1 I/123 45
2 I/234 8
tblDeliveries
ID InvRef Amt
1 I/123 10
2 I/123 15
3 I/123 20
4 I/234 5
5 I/234 3
How can we get the tblInvoice[Total] to compute automatically using an Excel formula? i.e. in pseudocode:
tblDeliveries[Total] = SUM(tblDeliveries[Amt] WHERE MATCH InvRef)
I have tried this Excel formula in tblInvoice[InvTotal] but it is returning an incorrect value:
=SUMPRODUCT(SUMIF(tblDeliveries[InvRef],[InvRef],tblDeliveries[Amt]))
Also tried swapping the first and second parameters. Produces a different amount, but still incorrect:
=SUMPRODUCT(SUMIF([InvRef],tblDeliveries[InvRef],tblDeliveries[Amt]))
If relevant, it is assumed that there is a 1:N relationship from tblInvoice[InvRef]:tblDeliveries[InvRef] and that tblInvoice[InvRef] is UNIQUE.
The syntax is incorrect for what you require.
=SUMPRODUCT(SUMIF(tblDeliveries[InvRef],[#InvRef],tblDeliveries[Amt]))
The # is the crucial difference.
Regards

How to match two sets of data by dates which do not synchronise and include missing values in Excel

Please forgive any errors or shortcomings in this question, it's my first on stackoverflow.
I have two sets of data in Excel of differing lengths and frequency, and would like to be able to place a value of 0 for where they don't synchronise, and match the rest.
For example, dataset 1 could be:
Date Set1
01-01-2010 10
01-03-2010 4
01-04-2010 8
01-05-2010 5
01-06-2010 10
01-09-2010 12
01-10-2010 9
01-11-2010 4
And dataset 2 could be:
Date Set2
01-03-2010 102
01-06-2010 104
01-10-2010 102
I'm looking for an output table that displays the values alongside each other for dates matching, 0 otherwise, like so:
Date Set1 Set2
01-01-2010 10 0
01-03-2010 4 102
01-04-2010 8 0
01-05-2010 5 0
01-06-2010 10 104
01-09-2010 12 0
01-10-2010 9 102
01-11-2010 4 0
I can't seem to be able to crack this with my limited knowledge and the lack of synchronisation in the data. Any help would be much appreciated, thanks.
You can do this using a VLOOKUP nested in an IFERROR statement.
The two equations used (and dragged down to last unique date row) are:
H3 = IFERROR(VLOOKUP(G3,A:B,2,0),0)) & I3 = IFERROR(VLOOKUP(G3,D:E,2,0),0))
This will not work if you have duplicate dates in the same data set with varying values since VLOOKUP will always return the first matched value (reading top down).
Place Set1 in A1:B9 (header in row 1). Add a column of zeros next to it in column C, so A2:A9 is dates, B2:B9 is values and C2:C9 is zeros.
Place Set2 (without the header) in A10:B12; move the Set2 data to column C and put zeros in column B, so A10:A12 is dates, B10:B12 is zeros, C10:C12 is values.
Sort the range A2:C12 by Date (column A).
Easier to show with a screenshot but newbies are not allowed to post images.

Get data from table with multiple criteria Excel

So i have information stored in a table. The columns are the date und rows are the Part. So i have another workbook open with different dates and parts but the table looks completely differnt with some addition rows in between. So i cant just copy&paste the data. I need a vba code to search for the correct entry and copy paste each single value. Similar to a index match function but in vba.
Could you give me some help how to start this?
So that would be my initial table:(Information 2)
Date 1 Date 2 Date 3
Part A 122 134 1212
Part B 453 3 4536
Part C 35 23 3
I need to copy that information into another table with different outline:
Part A Part B Part C
Info 1
Date1 Info 2 122 453
Info 3
Info 1
Date 2 Info 2 134 3
Info 3
Info 1
Date 3 Info 2 1212 4536
Info 3
How could i copy& paste the information into the new table?
How could i do that with index &match funtion?

Resources