So I need a bit of help I have a huge excel sheet with materials
Material Quantity
AA 10
BB 11
CC 52
DD 60
AA 16
DD 10
FF 20
QQ 400
RR 25
TT 80
AA 10
AA 122
FF 11
FF 12
GG 1
TT 15
What I would like to be able to do is to select the Value from 1st colum, let's say look for AA and automatically to get the SUM off all the Quantity AA ( In this example 10+16+10+122 = 158)
Although a SUMIF formula does work and might be placed wherever convenient (I have shown #Scott Craner's in D15) a PivotTable (as suggested by #Zahiro Mor) might be a lot more useful, not only because it can sum all Materials at one time but also for further analysis:
Related
I have a list like this (small example):
Orig Dest Qty
BEL PL 12
UK PL 45
BEL DNK 32
ESP DNK 22
UK CZE 14
BEL PL 11
UK PL 31
UK CZE 08
I would like to list it like this:
(Summarize the Qty by each origin-destination combination)
Orig Dest Qty
BEL DNK 32
BEL PL 23
ESP DNK 22
UK CZE 22
UK PL 76
So notice that every single combination is listed, and for each combination, the sum is displayed (alphabetical order is not necessary).
I hope it's possible without using VBA.
Thanks,
Ruben
With Excel-365 you can try below formulas.
E2=UNIQUE(A2:B9)
G2=SUMIFS($C$2:$C$9,$A$2:$A$9,E2,$B$2:$B$9,F2)
If you do not have UNIQUE() function then it would be hard to get unique list of Orig and Dest column by formula but still you can use SUMIFS() function.
I have the numbers in Column A and corresponding codes in B. Now for numbers in C I want to search for each one the closest value in A and show its value of B.
So I use the following array formula in D2 and it works for almost all cases, but is printing wrong value for last value in column C (38909). The closest value for 38909 in column A is 38909 and its related code is PUK, but is printing JIM that is related with the value 3890947021.
May somebody help me to fix the formula to match all cases in this table please. Thanks
Formula I have is:
=IF($C2="","",IFERROR(LOOKUP(9.99999999999999E+307,
SEARCH(IF(LEN($A$2:$A$15)>LEN($C2),"|"
&LEFT($A$2:$A$15,LEN($C2)),"|"
&$A$2:$A$15),"|"&$C2),
$B$2:$B$15),"NOT FOUND"))
Table
[A] [B] [C] [D] [E]
CC CODE NUMBERS RESULT NOW RESULT EXPECTED
237 CMR 18763044 JAM JAM
230 MUS 187635 JAM JAM
61 AUS 23092 MUS MUS
31 NLD 3162 NLD NLD
599 ANT 38050 NOT FOUND NOT FOUND
358 FIN 33 FRA FRA
33751 FRA 49185 NOT FOUND NOT FOUND
65 SGP 51078 NOT FOUND NOT FOUND
1721 SXM 1246 BRB BRB
1876 JAM 389094702 JIM JIM
81 JPN 38909 JIM PUK
124622 BRB
38909 PUK
3890947021 JIM
Update
After some hours I was able to get this formula that works if the values in column A are sorted ascending.
=IF($C2="","",IFERROR(
LOOKUP(9.99999999999999E+307,
SEARCH(
IF(OR($A$2:$A$15=$C2),"|"&$A$2:$A$15,
IF(LEN($A$2:$A$15)>LEN($C2),
"|"&LEFT($A$2:$A$15,LEN($C2)),
"|"&$A$2:$A$15)),
"|"&$C2),$B$2:$B$15),"NOT FOUND"))
Thanks for your comments.
If i understand your formula correctly it does exactly what it should. Problem is that 38909 is in 3890947021. For 38909 your formula had two possible matches so it gives you the last one. If you change the order in your column A and B like:
[A] [B]
CC CODE
237 CMR
230 MUS
61 AUS
31 NLD
599 ANT
358 FIN
33751 FRA
65 SGP
1721 SXM
1876 JAM
81 JPN
124622 BRB
3890947021 JIM
38909 PUK
you'll get PUK for both numbers 3890947021 and 38909. The only way I see is to add another condition to the formula which would check if there is exact match in column A but it still wouldn't solve your problem if the order were reverse.
I want to add two rows where a variable is same.
sample.csv:
A B
corn 56
apple 43
banana 54
corn 87
mango 63
apple 67
corn 30
I want to add values of B where A is same and want to store answer in another column as follows:
corn 162
apple 110
banana 54
mango 63
Can I do this in excel? If yes, then what is the formula for that? I searched a-lot but unable to reach solution.
Try,
Select an empty cell.
Go to Data - Data Tools - Consolidate
Select the range (both columns)
Press add
Tick Left column
Press ok
I have this data in Excel.
A B C
--------------------------------------
Line Number Value #1 Value #2
1 21 35
2 21 27
3 21 18
4 10 47
5 50 5
6 37 68
7 10 21
8 75 21
I tried to calculate the total "21" based on odd line number. In this situation, the answer should be 3. However, neither" IF(MOD(A1:A8,2)=1,COUNTIF(B1:C8,21)) " nor " {IF(MOD(A1:A8,2)=1,COUNTIF(B1:C8,21))} "worked and Google didn't yield anything helpful. Could anyone help me? Thanks!!
This works for odd lines:
=SUM(COUNTIF(A:B,21)-SUMPRODUCT((A:B=21)*(MOD(ROW(A:B),2)=0)))
there may be a better way of writing this formula.
Use this to count even lines:
=SUMPRODUCT((A:B=21)*(MOD(ROW(A:B),2)=0))
I only want to sort a file by the second character in the second column by the number order.
the sample file like this:
aa 19
aa 189
aa 167
ab 13
nd 23
at 32
ca 90
I expect the result like
ca 90
at 32
ab 13
nd 23
aa 167
aa 189
aa 19
I use the command sort -n -k 2.2,2.2 [filename].
But it shows me the result like this:
aa 167
aa 189
aa 19
ab 13
nd 23
at 32
ca 90
It is not the right answer. Does anybody know what's wrong with my command?
The problem is that you didn't specify the correct column delimiter, and sort assumes it's a tab instead of a space.
sort -t ' ' -nk 2.2
works just fine.
Edit: in my man page it says that any whitespace is counted as delimiter by default, but the fact is that adding -t ' ' solves it.
sort -t ' ' -k2.2,2.2 filename