Does excel have an if statement equivelent? I can't get this program to work - excel

The program has 5 columns.
Column A has item names
Column B has item sizes
Column C has item quantities
Column D has items that i need
Column E has the sizes for those items in the rows corresponding to the items
Most items do not have multiple sizes, but for the ones that do, there will be multiple entries of that item in column A.
What I need to do is take all the items from column D and find them in column A and give me the corresponding quantity from C.
I have been using this code to achieve this. =INDEX(C:C,MATCH(D:D,A:A,0))
This works for all items besides the ones with multiple sizes. For these items it just spits back the first size number every time.
Would there be a way to match A and D, and then check if there is a value in the size column, if so, give out the correct number?
I see how my wording is confusing here is an example of what I mean.
apples 5lb bag 12 apples 10lb bag
apples 10lb bag 13
bananas 5 grapes
grapes 7
Which using the is line of code "=INDEX(C:C,MATCH(D:D,A:A,0)) " would result in giving me the correct "7" for the grapes, but for the apples, it would give me the first result it comes across, which is the 12.
How would I get it to check the other columns to give me the 13 for apples?

If I understand correctly then this will get you the correct number:
=IF(E2<>"",SUMIFS(C:C,A:A,D2,B:B,E2),SUMIFS(C:C,A:A,D2))

Related

Displaying a label, sorted in a third column pulled from the first column according to data in the second column? i.e. Ranking

Imagine you have spreadsheet with data in a fixed # of contiguous rows.. let's say row 1 through row 20
Now let's say you have 3 columns of interest.
A, B and C
Column A is a label column.. the data in there are just string labels.. let's say types of canned food.. Tuna, Spam, Sardines, etc.
Column B is our number column.. let's say it is prices. e.g. 2 for Tuna, 5 for Spam and 3 for Sardines. These prices can change often very rapidly.. ok so prices are not the best example but let's imagine that prices change rapidly.
Now Column C is where we want to put the formula.
I would like to have a formula in Column C that will pull the labels from Column A, based on their prices in column B and rank them from highest to lowest.. that is C1 would calculate to "Spam", C2 to "Sardines" and C3 to "Tuna"
right now there are 20 rows of data.. but maybe at some other point there might be 30 or 6 or 40, etc.
So can someone help me out with the formula or at least explain what functions I need to use and the general idea involved? thanks
=IF(A2:A200<>"";SORTBY(A2:A200;B2:B200;-1);"")
You can simply use SORT formula. In this case =SORT(A1:B1000,2,-1) where A1:B1000 is range to be sorted, second parameter 2 is column number from range to sort by, 3rd parameter for order (-1 is desceding).
Place formula in C1 and you will get spilled array.

Excel IF statments

I am trying to come up with a conventional system in a way where I can do an if statement to fulfill a list of data filled names without using a VBA macro. This would use an IF statement to see if Column D has a value to a name, and if it does, puts it in the fulfilled list, and if it does not, does nothing and places the next name there if it has a value. There will always be 8 items in unfulfilled list as it is fixed/permanent names(values in E will change), and 4 or less in the fulfilled list.
EXPECTED OUTPUT:
Fulfilled List UnFulfilled List
A B D E
Apples 50 Apples 50
Oranges 75 Peanuts
Grapes 60 Oranges 75
Avacados 100 Grapes 60
Carrots
Avacados 100
Here is sort of my thought. It would check the value, if value is there, place value and then place name, if value is not there, check the next cell down. However this would fail as it would take e2 no matter what, when we only want it to take valid items.
Cell B1 = =if(e1="",e2,e1)
Cell A1 = =if(b1="Apples,d1,d2) nested if statement possibly?
Any help would be appreciated how I could go about this. Thanks!
If I understand correctly, you could either use a pivot table or use an array formula such as this in A1:
=IFERROR(INDEX($D$1:$D$3,SMALL(IF($E$1:$E$3>0,ROW($E$1:$E$3)),ROW())),"")
Note: Hit Ctrl + Shift + Enter and then drag down as needed
Note2: In this case were using row 1, if the data was below that then (e.g. a tbale with a header) where ROW() is becomes --> ROW()-ROW(reference to header cell)
You need to change:
$D$1:$D$3 - this should be the full list of items in column D
$E$1:$E$3 - similarly this should be the full list of the counts in column E ( change in both places - next to the IF and next to the ROWS)
Then in column B you can have a vlookup formula such as:
=IF(LEN(A1)>0,VLOOKUP(A1,$D$1:$E$3,2,FALSE),"")
Note: this assumes you have no duplicates in column D
Again you will need to change $D$1:$E$3 so that it has all the content in those columns
Hope that helps

Excel counting pairs

I have 5000 rows. In column A I have the salesperson , in column B the buyer. I am trying to find out how many times each combination appear together. e.g. Did salesman Abe sell to Buyer Bob 33 times, to buyer Carl 19?
ok takes a few extra columns to accomplish this but here goes...screenshot attached first.
First you need to concatenate the two columns (A and B)you want to enumerate in column C (the formula will accommodate a string in case names column is first last with spaces etc.)
=$A2&" "&$B2
Then in column D use the following formula to determine whether or not the name combination is duplicated but only true for one instance. I'll explain why in a second.
=$C1<>$C2
Then in column E count the matches.
=COUNTIF($C:$C,$C2)
After doing all that, filter results by "True" tally for all the True columns is the number of matching rep/customer relationships.

miss and match on excel

I'm not even sure if what i want to happen is possible but here it is :
So i have a list on column A and another on column B. Say, column A has apples, bananas, eggs... Then column B has apple pies, banana pies, egg pies...on column C, I want excel to tell me that apples and apple pies match and bananas and banana pies match, and so on. Then tell me if they don't match at all. I want it so that even if i want 2 values from column A to match with a value in column B. For example aside from apples there could also be pears in column A but i would still want pears to return a match value with apple pies. I hope this is not too confusing
... Thanks in advance!
Ok, I am going to give you multiple answers because I am not sure what the question is. If Gary's Student's comment is the right answer and you just want to match the contents then all you need to do is put this in C2 and copy it to every row:
=IF(ISERROR(FIND(A2,B2)),"no match","match")
But if your comment about 1-2=bad, 3-8=good and 9-10=very good is what you really want then all you need to do is put this in C2 and copy it to every row:
=IF(B2=CHOOSE(A2,"bad","bad","good","good","good","good","good","good","very good","very good"),"match","no match")
What that does is change the number in column A to be the equivalent string and then match that string against column B.
But if you are looking for a solution that works for both things then you need a dictionary. If you use ALL the piossible values from B as the keys and each matching value from A as the values then you can call MATCH twice and see if the value belongs to the key.
So for example the dictionary for the pie example might look like this (notice that pies can have more than one ingredient):
E F G H I J K
1 Key Value 1 Value 2 Value 3 Value 4 Value 5 Value 6
2 lemon pie lemon egg
3 apple pie apple pear
4 pear pie pear
5 egg pie egg
And the dictionary for the bad and good example would look like:
E F G H I J K
1 Key Value 1 Value 2 Value 3 Value 4 Value 5 Value 6
2 bad 1 2
3 good 3 4 5 6 7 8
4 very good 9 10
Then you can stick this in C2 and copy it to every row:
=IF(ISNA(MATCH(A2,OFFSET(F$1:O$1,MATCH(B2,E$2:E$20,0),0),0)),"no match","match")
What this does is look up the value in column B in the dictionary and find what row it is in. Then it offsets F$1:O$1 by that many rows so that the range for the outside match is the correct list of incgredients. Then it matches the value in column A by the list of ingredients that the offseted inside match produced.
Maybe some screenshots will help:

Excel count unique occurrences of a text entry based on a status contained in a seperate column

Alright, this is driving me insane...
I have a section of data in a spreadsheet that looks like this:
Column A Column B Column C
lksdf-46-we-32 Fire 1
lksdf-46-we-32 Fire 2
lksdf-46-we-32 Fire 3
lksdf-46-we-32 Fire 4
wgw3f-18-bw-11 Ice 1
wgw3f-18-bw-11 Ice 2
wgw3f-18-bw-11 Ice 3
wgw3f-18-bw-11 Ice 4
possf-12-he-91 Fire 1
possf-12-he-91 Fire 2
possf-12-he-91 Fire 3
possf-12-he-91 Fire 4
oiwen-20-lw-93 Water 1
oiwen-20-lw-93 Water 2
oiwen-20-lw-93 Water 3
oiwen-20-lw-93 Water 4
In another spreadsheet, named 'Variables', I have a lookup category that looks something like this:
Column A
Fire
Water
I need to find the number of distinct entries in column A of the raw data sheet where column B matches any entry in column A of the Variables sheet. What I'm looking for is an excel formula, but everything I've tried either returns duplicates (as a starting point) or returns 0. Also, could you please explain in detail how the query works in excel? I'm a fairly experienced programmer, but I'm having a heck of a time wrapping my head around these functions in excel that I've been tasked to finish by the end of the day.
Try this "array formula" somewhere in the raw data sheet
=SUM(IF(FREQUENCY(IF(ISNUMBER(MATCH(B2:B100,Variables!A:A,0)),IF(A2:A100<>"",MATCH(A2:A100,A2:A100,0))),ROW(A2:A100)-ROW(A2)+1),1))
confirmed with CTRL+SHIFT+ENTER
The formula uses FREQUENCY function, with the "bins" being the row numbers, and counts bins that have 1 or more entry. Entries are only made when the column B item matches Variables column A.....and the second MATCH function ensures that the same row number (the first match) is entered for each repeated item in column A, which guarantees that duplicates are not counted
This formula looks at 100 rows of data in raw data sheet, increase as required but note that formula is very "expensive" so may prove impractical with very large datasets

Resources