Is there a way to use a formula to get excel to look at values and determine if they have atleast a 25% match then to add their values. Kind of like a vlookup and IF function combined but I am not sure how to do the 25% part. The reason I ask this is because I have a data set with Company names that are the same company but they are all typed in differently so excel recognizes them as separate companies. For example:
Company: Value
XYZ Incorperated 25
XYZ Company 40
XYZ 12
ABC INC. 39
ABC inc. 10
ABC COMPANY 15
I need it to realize that all the companies with "XYZ" are the same and to add all their values. Same goes for "ABC". Again, I am not entirely sure it is possible but I haven't been able to find a way to get excel to sum it up for me.
Side note I could do it manually but the problem is that the data set is always changing so I need a formula that can recognize the similarities in each cell.
Try using Sumproduct. I am assuming that all of your Column A will start with the company name. (I.e. there won't be 'Company XYZ', only 'XYZ [...]'. If this isn't always going to be the case, let me know.
Does this work? I assumed Company is Col. A, Value is Col. B - going to row 7.
=SUMPRODUCT(--(LEFT($A$2:$A$7,LEN(E2))=E2),--($B$2:$B$7>=25),$B$2:$B$7)
So, if a cell has "XYZ" as company, and the "Value" for that row is 25 or greater, it'll add together. The XYZ cell equates to 65, and you can see the ABC correctly calculates 39.
edit: Here's a screenshot, using named ranges to maybe make it easier to see what goes where in the formula:
Yes try SUMPRODUCT it is great. Very simply, it look through column B which is the company names to match the left three characters in the name to what ever you type in cell E3 and sums the values in the value column.
=SUMPRODUCT(--(LEFT(B4:B9,3)=E3)*1,C4:C9)
Related
I have 18 students in a competition. I have their names listed in the first column. I have another column that has ratings. The ratings column won't change, but the names can move up or down depending on performance. If I wanted to compare two students, how can I type two names into cells to find the difference in value?
Ex.
Joe 63
Bill 59
Sarah 45
Deb 37
Jill 22
Tom 10
If I want to compare Jill to Sarah, I'll type Jill in one cell, type Sarah in the next cell and get the value 23. Also for any value that is 10 or less, I want it to equal 0. For example, Deb and Sarah are only 8 apart, which isn't significant, so it equals 0.
Thank you for your help.
Since we do not know which of the names will be the larger value and you are just looking for the difference, it will be important to use an absolute value comparison. For this solution I used data validation for the cells F1 and F2 to simplify the name selection to drop down boxes instead of actually typing in the names. Note there may be some issues if there are duplicate names in the list.
For the formula to get the difference use the following and update the references to suit your data:
=IF(ABS(INDEX(B1:B6,MATCH($F$1,$A$1:$A$6,0))-INDEX(B1:B6,MATCH($F$2,$A$1:$A$6,0)))<=10,0,ABS(INDEX(B1:B6,MATCH($F$1,$A$1:$A$6,0))-INDEX(B1:B6,MATCH($F$2,$A$1:$A$6,0))))
Given a table like this one below:
David
Mike
Lisa
David
50
10
40
Mike
0
50
50
Lisa
10
40
50
I'm trying to come up with a column of formulas and information that will automatically rank and label. See below for a correct output example.
Chosen Row ->
Mike (this cell is defined by the user)
Rank
Number
Mike
50
Lisa
50
David
0
Basically the user should be able to change the top right cell and have the rest of the table automatically adjust based on that input.
Here, the user input "Mike" into the cell, so the formulas should look into the row labeled "Mike" (with the values 0, 50, and 50 in that order) and tell me a list of the highest scoring column names, along with their scores.
The only thing that is tripping me up is integrating something into the formula that makes it skip names it has already put into the rank list. As you can see, there are 2 scores of 50 there.
There is a page for this on Microsofts website on dealing with ties, but I don't fully grasp their example where they use Countif, so I have not been able to translate it over for my purposes. They also use rank numbers to the left of the names in their example, but I'd prefer that not be necessary if possible. I don't mind writing the cell formulas by hand if auto-fill doesn't help me with certain aspects.
I know there is a way to accomplish this. I've played with the formulas and did a lot of research. I've just about resorted to coding it all in VBA, but I feel like that would be far more work. At this point I'm so close, I feel like I'm just missing one critical element.
If one has the dynamic formula in Office 365 then we can use SORT:
=SORT(CHOOSE({1,2},TRANSPOSE(B1:D1),TRANSPOSE(INDEX(B2:D4,MATCH(H1,A2:A4,0),0))),2,-1)
And Excel will spill the results correctly.
For older we need two formula:
First get the values in order:
=LARGE(INDEX($B$2:$D$4,MATCH($H$1,$A$2:$A$4,0),0),ROW(ZZ1))
Put that in H2 and copy down.
Then we need to reference those value to get the correct name:
=INDEX($B$1:$D$1,AGGREGATE(15,7,(COLUMN(INDEX($B$2:$D$4,MATCH($H$1,$A$2:$A$4,0),0))-MIN(COLUMN(INDEX($B$2:$D$4,MATCH($H$1,$A$2:$A$4,0),0)))+1)/(INDEX($B$2:$D$4,MATCH($H$1,$A$2:$A$4,0),0)=H2),COUNTIF($H$2:H2,H2)))
Put that in G2 and copy down.
I made in excel 2016, but I think it works in all versions. First I created a Rank, then I used the Index function. Download the file here:
https://1drv.ms/x/s!Apn_2zN0NfqFhWT-OdNazVTlxI2n?e=WsZLuH
Code for Rank using array formula:
=MATCH(LARGE(INDIRECT("B"&$K$1&":D"&$K$1)+COLUMN(INDIRECT("B"&$K$1&":D"&$K$1))/100000,ROW()-2),
INDIRECT("B"&$K$1&":D"&$K$1)+COLUMN(INDIRECT("B"&$K$1&":D"&$K$1))/100000,0)
I have the following example data set in excel.
Currently, for reference, John,Smith is in A4 and Smith Johnson is in B4.
Column 1 = Names of Members
Column 2 = Attended (list of members that attended a meeting).
Applied to column 1, I would like to add a function that turns GREEN any members that are in column 2 (attended) that are also in column 1.
Like so:
I am essentially trying to find a quick way of producing an attendance list, and highlighting those that were not present.
The difficulty is that it is not an exact match as the usernames in the attended list may contain the surname or last name but not in the format provided in column 1.
I should also mention that the attendees list could be variable, so the formula should ideally allow for a range from say B4 to B20, even if it is left blank.
Any clever and easy solutions?
To highlight those members that didn't attend:
Select A2:A9
Use conditional formatting formula rule:
=SUMPRODUCT(--ISNUMBER(SEARCH($B$2:$B$5&"*",$A2)))=0
I usually like to tell people that they will have to be carefull using partial matches to prevent false positives. What if you have someone called "Ann" and "Anne" and "Annet" and "Annette"? Therefor, allready a bit safer could be:
=SUMPRODUCT(--(LEFT(A2,FIND(" ",$A2)-1)=$B$2:$B$5))
EDIT:
Based on the new data and question you can try:
Select A4:A10
Use conditional formatting formula rule:
=SUMPRODUCT(--(MID($A4&" "&$A4,FIND(",",$A4)+2,FIND(",",$A4&" "&$A4,FIND(",",$A4)+2)-FIND(",",$A4)-2)=$B$4:$B$6))
I have a spreadsheet that looks like this:
Animal Where Quantity
Giraffe Wild 22
Lion Zoo 87
Tiger Zoo 56
Giraffe Zoo 15
Elephant Wild 94
Tiger Wild 47
Lion Wild 45
Elephant Zoo 12
Tiger Zoo 48
I need to return all quantities of Tiger, but only the ones in a Zoo, and I need to list those quantities on different cells in a column. I should be able to easily change the query from Tiger to any other animal.
Output should looks something like this:
Get the quantities of Tigers that live in a Zoo:
Tiger
56
48
Get the quantities of Lions that live in the Wild:
Lions
94
Can anyone help me figure this out?
misunderstood question
so you are going to have two cells somewhere that are going to represent your criteria. Lets call it cells D1 for animal type and cell D2 for location.
You are then going to use a combination of the following formulas: INDEX and AGGREGATE.
Lets start with AGGREGATE. Use it to build a list of row numbers that match the criteria your a looking for.
AGGREGATE(15,6,ROW(range of the first column of your table)/((range1=criteria1)*(range2=criteria2)*...*(rangeN=criteriaN)),row(A1))
15 tells AGGREGATE to generate a list sorted in ascending order.
6 tells AGGREGATE to exclude any errors from the list.
ROW() gives us the row number we are working with dividing by the criteria will only allow results where all criteria are true to be a valid list entry. Any False results will result in a divide by zero error and thus
exluding the ROW() from the list of results.
ROW(A1) tells AGGREGATE to return the Nth number in the list. so ROW(A1) will act as a counter as the formula is dragged down. It will increase by 1 for each row its copied to.
A couple of important things to note. AGGREGATE performs array like calculations. As such avoid full column references within the aggregate function. Large ranges within an array calculation can slow down your computer. Marke sure you lock your reference ranges with $ to prevent them from changing as you copy unless it is something you want to change such as row(A1)
So now you know how to get a list of row numbers for the answers you want. You now want to embed this information into an INDEX formula:
INDEX(A:A,AGGREGATE(...))
Repeat this for each column of information you want to pull updating the A:A part for where you want to pull the information from.
Proof of concept
in the the image I wrapped the whole formula in an IFERROR function to display "" when nothing is found. Handy for when you copy down more rows than there are results.
EDIT *
A JAN FEB MAR APR
1<drpdwn> A1+JAN A1+FEB A1+MAR A1+APR
what i need is for B1 to hold a formula that will take A1+B as a string and use this as the name of a Table to grab a value from. so something like
=INDIRECT($A1&"B")[[#Totals],[Column7]] so the cell will display the value in column 7 in the totals row for a table that is named the result of '=INDIRECT($A1&"C")' =B2&A3 also works for creating the variable, but again. unable to use in the above formula
Hopefully this is a little bit clearer
As an example, I will have 12 tabs that lets say are months, JAN FEB MAR etc... these are the column headers in my above.
Within these will be various Tables, like Expenditure, income, etc... they will be named ExpenditureJAN, ExpenditureFEB.
I want a simple (overview) tab, that lets me select expenditure in A1, and each months columns will use the formula to display a value from its relevant table, so A(JAN) would display jan's expenditure total etc.....
=ExpenditureJAN[[#Totals],[Column7]] this would work, but i need the expenditure bit, to change to what ever is selected from a picklist in A1.
***Old Question - Before edit -
Didn't know how to word the question, but here is my problem;
I have tables called AB, AC, AD, BB, BC etc...
I want to look up the following =AB[[#Totals],[Column7]] which works fine. However.....
I want it to change AB to be the string created from two cells so for instance =A3&B2[[#Totals],[Column7]]
Hopefully that makes sense, i am struggling to put this into words for some reason.... To add to this, A3 will be a drop down list, so the idea is, i change the value in A3 and it will change the table each cell the formula is in to look at the correct value.
B C D E
# #B #C #D #E
So # can change via a picklist, and the formula will detect this change and fire off to look at #totals, column 7 in the table #B/#C etc.. using the column headers and picklist as references for the table name.*
As user3514930 stated you want to use the INDIRECT function. Given the following table:
A B C D E
1<drpdwn> #B #C #D #E
If Cell B1 contains the formula =INDIRECT($A1&"B") it would show whatever is selected in cell A1 immediately followed by the character B. So drag that over to fill the rest of the row and update the trailing letter to =INDIRECT($A1&"C"), =INDIRECT($A1&"D"), =INDIRECT($A1&"E") etc. in the formulas.
Then when the dropdown box in cell A1 is changed, say to C the table would look like this:
A B C D E
1 C CB CC CD CE
Edit: So I got this to work like you wanted using INDEX, INDIRECT, and an additional cell to reference the table desired. I setup a table like you suggested named ExpendituresJAN. It had 6 columns, first was Week1-Week4, then HR, IT, Admin, Sales, and Payroll for departments, and then Column7 where I had totals per week. I threw in some random numbers (IT had a heck a week 3, spending nearly $997k evidently, and the sales department outdid itself with it's end of month party running over $10k, but those boys do love to party!). Sorry, where was I? Oh yes, example table, I added a Totals row on, and went to trying to figure it out because INDIRECT really seemed to be the key and I just had to wrap my head around things.
Next sheet had basically 4 cells with anything in them. A2 had a dropdown where I could Choose JAN, FEB, or MAR. B1 said JAN (I imagine C1 would say FEB, but I didn't go that far). B2 said #REF! a lot of the time.
________| JAN
<drpdwn>| #REF!
In the end A2 was moved down to A3 for my dropdown box, and row 2 was hidden, I'll get to why that is in a second. Ok, how to reference that... I can't seem to do it traditionally with structured reference, which is a pain, but there's got to be a way around it. I crack my knuckles, pull up Chrome, and practice a little Google-fu. Turns out what we needed was INDEX, which will return a cell or range from a table by name. B2 (hidden now) now contains the formula ="Expenditures"&A3 which, when JAN was selected read ExpendituresJAN. Excellent, I'm pretty sure we're most of the way there now. I just have to phrase my INDEX right and I'm set.
So, INDEX ended up being relatively simple all in all, but there's a catch. No #Totals row accessibility for INDEX. I got hung up on that for a few minutes until I stepped back and thought "wait, what's my totals row except a =SUM() formula? Ok, I can duplicate that. INDEX works with this syntax: INDEX(array/table, Row#, Col#) but you can use 0 for the row and it takes the entire row into account. Perfect for what I want, since I want a sum of Column7, I'll just wrap the INDEX in a SUM function.
=SUM(INDEX(INDIRECT(B2),0,7))
That spits back $1,036,371.00, the exact same thing my totals row shows for Column7. The only complication I could see is if your different tables have different Totals rows, as in one does a SUM, one does an AVG, and what not. Then the formula starts getting a bit more complex.