I have a spreadsheet with a list of items in one column (A) and in column C shows the total sold. I'm trying to find all the items within column A.
The issue is, some items are the same, only they have a suffix, mostly separated by a -. The values in column C would be different as well.
Example:
ABC = 5
ABC-123 = 3
ABC-543 = 2
I'm looking to identify only 123 and then combine all the values, so that it will show ABC and 10 as the total.
I've looked around how to remove the duplicate suffix, but have so far failed to find a method when trying to add the total values.
Many thanks
do you mean the data you have looks like this:
column A column B column C
ABC 5
ABC-123 3
ABC-543 2
if so, you can select column A then go to data then text to columns then delimited select other by putting - sign, next and finish.
result must be:
column A column B column C
ABC 5
ABC 123 3
ABC 543 2
then you can =sumifs(C:C;A:A;"ABC") (keep in mind that column B must be empty)
if you have ABC-123 = 3 in the same cell as a text, then you can do:
=IF(SEARCH("ABC";F3);RIGHT(F3;LEN(F3)-FIND("=";F3)-1);"")
where F3 is equal to ABC-123 = 3 The formula above searches fo ABC and gives you a value after = sign, no matter how long this value is. If there is no ABC it will return an error.
if there is no need to look for ABC then just use:
=RIGHT(F3;LEN(F3)-FIND("=";F3)-1)
I hope this helps. I cannot comment, so ask if you have questions.
Best - AB
Related
I am trying to sum values based that equal a lookup value. However, that value is actually a list of values delimited by a comma. Below is an example of what I mean.
Suppose I have raw data in the form of sheet1 below:
Sheet1:
A
B
1
ID
VALUE
2
A
30
3
A
50
4
A
20
5
B
10
6
B
20
7
C
70
8
C
40
9
D
30
10
E
50
11
F
20
12
F
30
13
G
10
And I have a look table that groups all IDs by their respective teams, as per sheet2 below.
Sheet2:
A
B
1
TEAM
IDS
2
Red
A, B
3
Blue
C, D
4
Green
E, F, G
And I want to create a report where the user can select the team name, and the sum of the values in sheet1 will aggregate based on the selection, as per the following example. So the user would select "Green" in cell B1 and it would return the sum of values that correspond to E, F, and G in sheet1.
Report:
A
B
1
Select Team:
Green
2
Sum:
110
I have searched all over for a solution to this and was able to find something similar. I tried to repurpose the formula for my data but couldn't get it to work because I think that solution dealt with numbers rather than text.
Excel: Perform a SUMIF where the criteria is a comma-delimited list
Any suggestions would be greatly appreciated!
Edit: Just want to add that I realize I could first parse out the IDs in sheet2, however I'm looking for a formula that can bypass that as my real dataset is quite large and parsing out the IDs under each team would explode the number of rows.
A variation of #JvdV solution on the linked question:
=SUMPRODUCT(SUMIFS(Sheet1!B:B,Sheet1!A:A,FILTERXML("<t><s>"&SUBSTITUTE(VLOOKUP(Sheet2!F1,Sheet2!A:B,2,FALSE),",","</s><s>")&"</s></t>","//s")))
Note, this only works with Excel 2013 or later and only on PC. FILTERXML is not available on Mac or prior to 2013.
If Mac or prior to 2013:
=SUMPRODUCT(SUMIFS(Sheet1!B:B,Sheet1!A:A,TRIM(MID(SUBSTITUTE(VLOOKUP(F1,Sheet2!A:B,2,FALSE),",",REPT(" ",999)),(ROW($ZY1:INDEX($ZY:$ZY,LEN(VLOOKUP(F1,Sheet2!A:B,2,FALSE))-LEN(SUBSTITUTE(VLOOKUP(F1,Sheet2!A:B,2,FALSE),",",""))+1))-1)*999+1,999))))
Given the table below:
A
B
C
D
1
happy
1-veggies
GHF
1
sad
1-veggies
HGF
2
angry
1-veggies
GHG
2
sad
1-veggies
FGH
3
sad
1-veggies
HGF
4
moody
2-meat
FFF
4
sad
2-meat
HGF
5
excited
2-meat
HGF
I need to count the number of rows where C="1-veggies", B="sad", A has a duplicate within A and whose alternative rows in A have a value in D = "GHF" or "FGH".
The result should be 1 based on the second row.
The second row has B= "sad", C = "1-veggies", A has a duplicate within A, whose value is "1" and the 1st row, also with A = "1" has a value in D = "GHF".
I already have a formula as follows:
=SUMPRODUCT((B1:B8="sad")*(COUNTIF(A1:A8,A1:A8)>1)*(C1:C8="1-veggies")*(D1:D8="GHF"))
However, it isn't able to check the 1st row nor does it check the necessary OR statement on column D.
I don't know how to accomplish either task. Thank you.
Add some more COUNTIFS():
=SUMPRODUCT((B1:B8="sad")*(COUNTIF(A1:A8,A1:A8)>1)*(C1:C8="1-veggies")*(COUNTIFS(A1:A8,A1:A8,B1:B8,"<>sad",D1:D8,"GHF")+COUNTIFS(A1:A8,A1:A8,B1:B8,"<>sad",D1:D8,"FGH")>0))
Basically you want to select rows where C="1-veggies", B="sad" and join them to rows where D = "GHF" or "FGH", but with a condition that the value in column A is equal in both but the row number is unequal. This might be a good use of Power Query for users who are expert in this, but using formulas is problematic because of the limitations of countifs (has to be a range). A workaround if you have Excel 365 would be to use some filters followed by countifs:
Column E
=FILTER(A1:A8,(B1:B8="sad")*(C1:C8="1-veggies"))
Coumn F
=FILTER(ROW(A1:A8),(B1:B8="sad")*(C1:C8="1-veggies"))
Column G
=FILTER(A1:A8,(D1:D8="GHF")+(D1:D8="FGH"))
Column H
=FILTER(ROW(A1:A8),(D1:D8="GHF")+(D1:D8="FGH"))
Then
=SUM(COUNTIFS(E1#,G1#,F1#,"<>"&H1#))
I am trying to match 2 values on a table and if match, display the value from other column. Example is as below,
A B C D E F
ABC 1 WWE 5 output (1 FROM ABC) output (10 FROM ABC)
GHI 2 XYY 1
XXY 3 ABC 10
May I know how to do it? Can it be done in Excel
Use an INDEX/MATCH formula, for example in column E:
=INDEX(B:B,MATCH($A1,A:A,0))
And in column F:
=INDEX(D:D,MATCH($A1,C:C,0))
I'd usually wrap these in an IFERROR(,"") function to tidy up any errors. These formulas are based on you searching for the value in column A each time, if you want to search for a string instead simply replace $A1 with "ABC".
I have two columns of data, they look something like this:
A B C D
1 2 SOME RECORD
2 6 SOME RECORD
3 10 SOME RECORD
4
5
6
7
8
9
10
So basically column A is a list of indices, where some of them appear in column C with corresponding records saved in column D. Column B is currently empty, and what I want to do is if say index 2 appears in both column A and column C (they matches), then put the record beside C2 in the cell B2. So essentially I want it to look like this:
A B C D
1 2 SOME RECORD
2 SOME RECORD 6 SOME RECORD
3 10 SOME RECORD
4
5
6 SOME RECORD
7
8
9
10 SOME RECORD
Can someone help please?!! Thanks!!!
UPDATE: I tried this and it doesn't work. The data in column D is calculated using a UDF and is refreshing every 1 second. The VLOOKUP function fails even though I can see the 2 indices are the same!! Is it because of the format of the cell or column? I.e. does vlookup compare data type as well?
Assuming your data in A starts from A1 - put in B1 the following and autofill:
=IFERROR(VLOOKUP($A1,$C:$D,2,0),"")
This includes handling of missing values.
You'll want this:
B1=VLOOKUP(A1, C:D, 2, FALSE)
This will look up the value in column A within the array spanning columns C and D. It will give you the value found in the second column (D). FALSE makes it an exact match, otherwise you might get 2 and 20 matching because hey, they're kind of similar...
I am trying to compare two columns in excel, A and B. Column A contains a complete list of customer numbers. Column B contains an incomplete list of the same customer numbers. So if a customer number is in A, but not in B then output that number to column C.
I'd use the MATCH function in combination with ISNA.
If I have the following table
A B C
1 4
2 3
3 1
4 7
5 2 5
6 6
7
I put in column 'A' the full customer list, and in column B is a random ordered partial list. I then put the function in C1 (and the rest of column C):
=IF(ISNA(MATCH(A1,B:B,0)),A1, "")
Now I see the values '5' and '6' only in column C, because those are the only two numbers that don't appear in column B.
In Cel C1 =IF(ISERROR(VLOOKUP(A1,$B$1:$B$10,1,FALSE)),A1,"")
Adjust for row counts and fill down against column A.
I think you're looking for something like this:
=IF(ISERROR(MATCH(A1,B1,0)),A1,"")
Propegate that formula along your new column and it'll reprint the populated Column A when Column B is a no match.
Reference URL: http://support.microsoft.com/kb/213367
(I believe I read the original question wrong, and am going on the assumption that column A and B are already sorted where the values will line up.)