How to use IFS more concisely- excel - excel

I'm trying to search many cells in the B column for the number 1. When the 1 is found, I want to display the value in the A column of the row in which the 1 was found. I am very new to excel formulas, but this is what I tried:
=IFS('8&Under'!B3=1,'8&Under'!A3,'8&Under'!B4=1,'8&Under'!A4,'8&Under'!B5=1,'8&Under'!A5,'8&Under'!B6=1,'8&Under'!A6,'8&Under'!B7=1,'8&Under'!A7,'8&Under'!B8=1,'8&Under'!A8,'8&Under'!B9=1,'8&Under'!A9,'8&Under'!B10=1,'8&Under'!A10,'8&Under'!B11=1,'8&Under'!A11)
It works, but is horribly long, and I will need to recreate it many times for the whole application to work out.
Thanks.

You may want to use FILTER to dynamically show a range based on matching criteria
https://support.microsoft.com/en-us/office/filter-function-f4f7cb66-82eb-4767-8f7c-4877ad80c759

you can use either function
Normal function =IF(B2=1,"Found the number 1","")
Range function =IF(B2:B27=1,"Found the number 1","")

Related

Automate concatenation process

Here I am stucked with one excel issue where i want to concatenate from column F till column I where the logic is when the benchmark column A3 (for example) is blank it need to concatenate column F till column I till there is a value at column A4.and this logic need to automatically concatenate the mentioned column till there is a value under the benchmark column. currently i need to keep change the concatenate range in order to concatenate it fully with the logic. Appreciate if anyone can help me out.
Below image shows how i am doing manually which very time consuming
You can use the MATCH function (with a wildcard) to find the next non-blank row; and use that in an INDEX function to detect the range to concatenate.
Assuming your data starts in A3 and the lowest possible row is row 1000 (change the 1000's in the formula below if it might be much different:
J2: =IF(A2="","",CONCAT(INDEX(F2:$I$1000,1,0):INDEX(F2:$I$1000,IFERROR(MATCH("*",A3:$A$1000,0),1000-ROW()),0)))
Note: It is possible to also develop solutions using INDIRECT and/or OFFSET. Unfortunately, these functions are volatile, which means they recalculate anytime anything changes on your worksheet. If there are a number of formulas using these functions, worksheet performance will be impaired. INDEX and MATCH are non-volatile (except in ancient versions of Excel - pre-2003 or so)
The OFFSET-function would come on handy here. One solution is to do it like
This works in my worksheet.
Cell Q6 just defines the number of rows downwards that the MATCH-function is checking for the next "HEADER1" value. If "HEADER1" is found, the MATCH-function returns how many rows down-1. If no "HEADER1"-value is found within that range, that value is then the number of rows used.
If the first column also has "HEADER2" and so on, you can add the MID-function to both references inside MATCH to limit which part of the string are to be searched for.
I tried to adjust the references properly to fit your sheet, but I may have missed something:
=IF(ISBLANK($B2),"",CONCAT(OFFSET($B2,0,0,IFNA(MATCH(MID($B2,1,6),MID(OFFSET($B2,1,0,$B$1),1,6),0),$B$1),4)))

Find text in range and extract number from alphanumeric cell

Worksheet 1 contains a list of names and quantities that are updated daily below (i.e. AAA is a name and 1 is the quantity):
Name
look.AAA :1
look.BBB :2
look.CCC :3
I'm trying to get the table in Worksheet 2 to search for text within the column range and extract the quantities using formulas.
So far i've tried search, lookup, vlookup, find & match functions (and combinations of these) but everything produces errors. I've tried to see if someone else has done something similar but I could not find anything online:
=match(aaa,sheet1!A2:A4)
I'm expecting to retrieve the quantity number by searching for the name and finding it within the text of a cell range.
You are on the right track. There are several ways to do this. VLOOKUP, LOOKUP, and a combination INDEX/MATCH are some of the more common methods. Since you started with match, this solution will carry on with your methodology.
Match is going to tell you which row of the selected range you are looking for. What you need to do is return the value from the same row but in a difference column. For starters we just need to tweak you match formula. Since you are looking for a string (text), and are hard coding it, the text value should be in quotes. Your Match formula becomes:
MATCH("AAA",sheet1!A2:A4,0)
That zero at the end tells match you are looking for an exact match. The other possible values for 0 are 1 and -1, but you need to have a sorted list and they will do an approximate match going forward or in reverse respectively. For a reverse search the list needs to be sorted in reverse order.
Now that you have a formula for the correct row within the selected range, you can use that in an INDEX formula from a matching size range somewhere else in the workbook. In this case you have it in the adjacent column. Your ultimate formula becomes:
INDEX(Sheet1!B2:B4,MATCH("AAA",sheet1!A2:A4,0))
Alternative options
VLOOKUP
VLOOKUP("AAA",sheet1!A2:B4,2,0)
See below revised solution:
I have given a name "Look_Rng" to the list which contains the original data.
My logic is to use a combination of MID, LEN and FIND functions to extract a number range and a text range from the original range first:
Number Range: {=--MID(Look_Rng,FIND(":",Look_Rng)+1,LEN(Look_Rng)-FIND(":",Look_Rng))}
which will return {1;20;300;3;2}
Text Range: {=MID(Look_Rng,MIN(IFERROR(FIND(D2,Look_Rng),33000)),LEN(D2))}
which will return {"AA";"oo";"CC";"e.";"lo"}
Then use MATCH function to find the position of the given name in the Text Range. For instance, if you are looking for CC in the Text Range, it will return 3.
Lastly, use INDEX function to locate the value in the corresponding position in the Number Range. For instance, CC is in the 3rd place in the Text Range, so its corresponding position in the Number Range is 300.
The full formula is quite long, and you MUST press Ctrl+Shift+Enter when exiting the formula to make it work because it is an ARRAY FORMULA.
{=INDEX(--MID(Look_Rng,FIND(":",Look_Rng)+1,LEN(Look_Rng)-FIND(":",Look_Rng)),MATCH(D2,MID(Look_Rng,MIN(IFERROR(FIND(D2,Look_Rng),33000)),LEN(D2)),0))}
Let me know if you have further questions.
P.s. I agree with #ForwardEd that it would be much easier if you use a couple helper columns to break the original data down and use simple INDEX+MATCH or VLOOKUP to look for the value. My answer used the same logic anyway.

Simpler formula for a 5 nested if command

I have been scouring forums for a solution but am striking out so far. I want to do a countA of all non empty cells -1. The data I'm pulling from is in Q:U, and I want to do a count based on the header of the columns in row 2. Because of where the data comes from in Q:U, the column order is not always going to be the same.
I have the following string which works where I can replace each instance of "Test" with the particular header I am looking for. Is there a simpler command using a combination if Index and Match that would work? Or even a better solution?
=IF($Q$2="Test",COUNTIF($Q$3:$Q$150,">0")-1,IF($R$2="Test",COUNTIF($R$3:$R$150,">0")-1,IF($S$2="Test",COUNTIF($S$3:$S$150,">0")-1,IF($T$2="Test",COUNTIF($T$3:$T$150,">0")-1,IF($U$2="Test",COUNTIF($U$3:$U$150,">0")-1,0)))))
use:
=COUNTIF(INDEX($Q$3:$U$150,0,MATCH("Test",$Q$2:$U$2,0)),">0")-1
You can replace "Test" with a cell reference that you then can change to look up different columns by their name.

Get current row in from sumif statement

I'm using Excel 2010 and have a datasheet with multiple tabs, this is the current SUMIF function that I am using
=IF(SUMIF('Master Data'!$J$2:$J$200,'Resource View (2)'!B22,'Master Data'!$W$2:$W$200)>0,Current_row_different column, "")
Basically, I find some rows in the other sheet that have a value of 1 I then want to use these rows that have a value of 1 but use a different column within that row to populate the true condition.
So say for instance row 4 contains a 1 at column A I then want to stay on row 4 but get the value of column B for the true condition.
Is this possible?
EDIT:
I have now managed to get the function working however its a bit of an Excel hack, because I have had to move the columns around in the master data and its a bit messy now anyway here's what I've got
=IF(SUMIF('Master Data'!$C$2:$C$200,'Resource View (2)'!B22,'Master Data'!$W$2:$W$200)>0,VLOOKUP(B22,'Master Data'!$C$2:$F$90,3,FALSE),"")
Now I know this is because VLOOKUP searches through the first column specified and it doesn't seem to work at all if i try to put the range in backwards i.e. $F$90:$C$2 instead of $C$2:$F$90. Is there any way to manipulate VLOOKUP to work like this?
Yes, actually there is a way - a brother of VLOOKUP - it's INDEX(MATCH()). It is a very useful tool, as you can look at any column and return any other, not only looking at the first one to return the ones to the right. Also, INDEX(MATCH()) can be used in forming array formulas, if you need that, while VLOOKUP cannot.
Basically, this part of your formula:
VLOOKUP(B22,'Master Data'!$C$2:$F$90,3,FALSE)
would be changed with this:
INDEX('Master Data'!$E$2:$E$90,MATCH(B22,'Master Data'!$C$2:$C$90,FALSE))
So, after all, the equivalent for
=IF(SUMIF('Master Data'!$C$2:$C$200,'Resource View (2)'!B22,'Master Data'!$W$2:$W$200)>0,VLOOKUP(B22,'Master Data'!$C$2:$F$90,3,FALSE),"")
would be
=IF(SUMIF('Master Data'!$C$2:$C$200,'Resource View (2)'!B22,'Master Data'!$W$2:$W$200)>0,INDEX('Master Data'!$E$2:$E$90,MATCH(B22,'Master Data'!$C$2:$C$90,FALSE)),"")

Searching for an excel entry with 2 conditions to be met

I have a dataset on excel with more than 40k entries, and there are 2 columns.
I want to find if there exists an entry for example with 1 in the first column and 1687 in the second column, I tried using this following IF function:
=IF(COUNTIF(B2:B178,"1687"),"Yes","No)
where A1:A178 have 1 in the first column.
This function works perfectly alright, however in terms of selecting the range for Countif, it requires much work as sometimes the range i have is more than 3 to 4k. This is way too time consuming as I have to repeat this search for many pairs of numbers.
I then tried by adding a helper column, where the 1st entry would be "=A2&B2"
My plan was to search this entire helper column for "11687" instead, however this fails to identify entries where it has 1 in the first column, 1687 in the second, and 11 in the first column, and 687 in the second column.
Ideally if the "find" function (Ctrl+F) could find 2 columns for different values it will be exactly what I need.
Could anyone please advise me on how to do this search?
Thank you very much!
Try this formula and fill it all the way down, should be more efficient than COUNTIF:
=IF(AND($A1="1",$B1="1687"),TRUE,FALSE)
Then you have a column of TRUE/FALSE that you can use to do what you want.
Change your range into a table and use built in Excel filtering capabilities. See http://office.microsoft.com/en-001/excel-help/filter-data-in-a-range-or-table-HP010073941.aspx#BMfilter_text

Resources