Give the different row value when text string found in another - excel

Having issues with merging some IFs and VLOOKUPs most probably.
Basically, workflow would look like below and I don't quite know how to type it into one formula.
Look for value from Values to look for in the table on the right hand side.
If found in the list text string, return the corresponding value from add/remove column to B column.
Excel screenshot sample

The answer will only work if you make the name for the values unique. What I mean by this is, that you will need to change the name of value1 to value01 if you have more than 10 values. If you have more than 100 values, than you will need to change the name to value001 and so on.
Then use this in B2 and drag down as needed:
{=INDEX($D$3:$D$6,MATCH(TRUE,FIND(A2,$E$3:$E$6)>0,0))}
NOTE: you dont have to entere the brackets {}. These just indicate that this is an array-formula. This needs to be entered with CTRL + SHIFT + ENTER instead of the normal ENTER.

try this formula: =IF(IFERROR(SEARCH(A2,E2),"Not Found")="Not Found","Not Found",D2)
also please see the screenshot attached Example

Related

Array formula to show value if it does not match

What I am trying to do is find a formula that I have been unsuccessful in locating and alter it to what i need it for. What I have is a list where names are duplicated throughout with different values on either side of the name. I would like to be a way where specific thing happen.
I will try to explain and give an example.
In Column A I have all of the names, not in any particular order, just all jumbled. In column B I have a time or the value "off" if someone is not scheduled for that day. What I would like to do is is find each instance in which "John" is working and return the value if it does not say that he is off or vacation.
Example
The formula I have that shows every instance is here. This would reside in D2:
Code:
={IFERROR(INDEX('$B:$B,MATCH(0,IF($C$2=$A:$A,COUNTIF($D$1:D1,$B:$B),""),0)),"")}
The formula I tried but have not had any success is here:
Code:
={IFERROR(INDEX('$B:$B,MATCH(0,IF(NOT(OR("Off"=$B:$B,"Vacation"=$B:$B)),COUNTIF($D$1:D1,$B:$B),""),0)),"")}
Any help would be appreciated!
Made some changes in your formula:
=IFERROR(INDEX($B:$B,MATCH(0,IF(($C$2=$A:$A)*("Off"<>$B:$B)*("Vacation"<>$B:$B),COUNTIF($D$1:D1,$B:$B),""),0)),"")
This is an array formula so commit it by pressing Ctrl+Shift+Enter.
Referring whole column (like $A:$A or $B:$B) in array formula makes execution very slow and hence is not advisable, instead use the range with data such as
=IFERROR(INDEX($B$1:$B$9,MATCH(0,IF(($C$2=$A$1:$A$9)*("Off"<>$B$1:$B$9)*("Vacation"<>$B$1:$B$9),COUNTIF($D$1:D1,$B$1:$B$9),""),0)),"")
I found slightly different formula than what you are trying to use, but it might help you. (in the codes below "John" is in C2)
=IFERROR(INDEX(B:B,AGGREGATE(15,6,ROW(B:B)/((B:B<>"off")*(A:A=$C$2)),COUNTA($A$1:A1))),"")
if you want it to remove also "vacation" then
=IFERROR(INDEX(B:B,AGGREGATE(15,6,ROW(B:B)/((B:B<>"off")*(B:B<>"vacation")*(A:A=$C$2)),COUNTA($A$1:A1))),"")
in my localization I am using ";" instead of your "," (I already changed that in the examples) so there might be some other minor changes you need to apply to the code... btw you dont need to enter this as array formula.

Drop Down List VLOOKUP Returns Multiple Matches

I am trying to create a VLOOKUP that returns multiple names when it matches with a color while using a drop down list.
I created this down list.
and associated VLOOKUP to reference the drop down list, but I know that it can only return one value at a time. Is there a way to go about returning multiple values?
So Basically if I'd like when I select a color from the drop down list to return this.
As you can see from my VLOOKUP, I'm referencing this table array on another sheet.
Any help would be greatly appreciated. I hope I provided enough information, if not please let me know and I'll provide as needed.
Thanks!
Try using this =IFERROR(INDEX('Customer Health Data'!$A$3:$A$36, SMALL(IF($A$1='Customer Health Data'!$C$3:$C$37, ROW('Customer Health Data'!$C$3:$C$37)-ROW('Customer Health Data'!$C$3)+1), ROW(1:1))),"" )
Press Ctrl + Shift + Enter and copy it to below cells.
If Cell A1= Yellow then the list of data with Yellow appears
Sample data sheet for Customer Health Data
Vlookup won't be able to do it, without a lot of tweaking. Instead, you can use an Index formula, with Small.
This is a simple example, so adjust the ranges as necessary:
=INDEX($A$1:$A$11,SMALL(IF($B$1:$B$11=$D$1,ROW(B$1:B$11)-ROW(B$1)+1),ROWS(B$1:B1)))
Where: A1:A11 has what you want to return (in your case, the hospital names). B1:B11 has the Colors you want to search with. Note the cell anchoring
Enter as an array formula (with CTRL+SHIFT+ENTER) and drag down. You'll get #NUM errors once it exhausts your matches, so just wrap IfError([formula],"") around it to hide that.

Excel Function Return Max Two Values

I am looking to get some help with a function that I am sure is an option but I sadly have no clue on how to implement.
Basically, I'd like a formula to go from C21:C50 and look for the top two values. Based upon which two are the top, it would reference the name in B column and populate that value in the another cell (the cell the formula resides in)
If you look at the image, in the primary field, we'd have Steve. Secondary would be Alan.
Is this something anyone can help with? I simply am lost :(
Try
=INDEX($B$3:$B$7,MATCH(LARGE($C$3:$C$7,ROW(A1)),$C$3:$C$7,0))
with Bob in cell B3 and the "primary" formula in cell C9. Copy down to cell C10.
If dealing with integers, you can simply add +1/ROW([range]) to avoid doubles:
=INDEX($B$3:$B$7,MATCH(LARGE($C$3:$C$7+1/ROW($C$3:$C$7),ROW(A1)),$C$3:$C$7+1/ROW($C$3:$C$7),0))
This is an array-formula and must be confirmed with ctrl+shift+enter!
However, this may fail for numbers like 5.01 or 4.99. For that case just use it in combination with RANK.EQ:
=INDEX($B$3:$B$7,MATCH(LARGE(RANK.EQ($C$3:$C$7,$C$3:$C$7,1)+1/ROW($C$3:$C$7),ROW(A1)),RANK.EQ($C$3:$C$7,$C$3:$C$7,1)+1/ROW($C$3:$C$7),0))
This is an array-formula and must be confirmed with ctrl+shift+enter!
The steps as picture:
The first table shows the direct adding of 1/ROW which is used for LARGE and MATCH to get the row if doubles exist (so INDEX can pick the correct one)
The second table shows how the values get replaced by their rank with RANK.EQ and then are treated the same like the first table.
The third (grey) table shows, what would happen if the first formula is applied to the second table (to demonstrate how the ranks get messed up).
For Excel 2007 just replace the RANK.EQ($C$3:$C$7,$C$3:$C$7,1) with RANK($C$3:$C$7,$C$3:$C$7,1).
If you still have any questions, just ask :)

Loop through column, search for text, get value of X

I would like to create a CommandButton macro in excel to determine if the name is the same with the one I'm searching for and if it is the same I will be getting the value of the cell beside it and add it all together to get the final amount.
This will be the example that I would like to do:
this will be the flow:
I will first check if the cell value is the same with the name
If it is James I will get the amount and add it to the total value for James, same goes for Ramirez
After everything is checked the accumulated value will then be placed on the cell beside James/Ramirez's name
Is there a way to do this in Excel? or any faster way to do this without using a commandbutton?
You don't need to use marco for this.
You can simply type in a function
In the example shown below,
E2:=SUMIF(A2:A6,D2,B2:B6)
E3:=SUMIF(A2:A6,D3,B2:B6)
EXPLANATION
=SUMIF(range_where_the_keyword_will_be,term_to_search,corresponding_values)
If you type "Ramirez" in D2, E2 will give you "300".
TIPS
If you want it to give you a message (such as, "not existing"), when you type in a name that is not in the list, you can try the function below.
=IF(COUNTIF(A2:A6,D2)<>0,SUMIF(A2:A6,D2,B2:B6),"Not existing")

SUMIF for a wider range

I have a problem that has been nagging me for a while now. I am a novice in Excel. Hence excuse me if this comes across as silly.
I have the following array of data:
I need to obtain the sum of values corresponding to the row entry "book".
I have used the formula sumif(B4:F7,"book",C4:F7). However excel returns the value in column c alone (i.e value returned is 10).
Update
I ammended my formula as follows:
I now obtained the correct sum - i.e 70. However, I deal with large volumes of data and using this formula is not efficient. Can anyone suggest a quick workaround for this?
Your guess is correct. There is a simpler way, but it is not easy to find it out for a novice user. You will need to use an array formula to do what you need.
Type this formula:
=SUM(IF($B4:$B7="book",$C$4:$F$7,0))
and enter it using Ctrl + Shift + Enter instead of just Enter
You can see the result in this picture (my delimiter is ; while yours will be ,, but that does not make a difference):

Resources