Excel if function and conditions thereafter - excel

Please see the table :
Based on the table, I need to display only those brand of cars manufactured by maruti in column E. I used =VLOOKUP("maruti",A:C, 2, FALSE) but gives result only in one cell. When I drag it down, it brings in duplicate results. Where am I going wrong in this? Is Vlookup the correct formula to achieve my requirement?

OPTION 1)
IF formula
=IF(A1="Maruti",B1,"")
Place that in E1 and copy down. When A in the same row has "Maruti" it will display the corresponding value from column B. If it does not have Maruti, it will display "" which is essentially a blank for display purposes.
OPTION 2)
INDEX/AGGREGATE Formulas
=IFERROR(INDEX($B$2:$B$15,AGGREGATE(15,6,ROW($A$2:$A$15)/($A$2:$A$15=$D$2)-ROW($A$2)+1,ROW(A2)-1)),"")
Place that in E2 and copy down to E15. Place the name your are looking for in D2.
For more information on formulas used follow the links:
AGGREGATE Formula Excel 2010 and later
IF Formula Excel 2007 and later
IFERROR Formula Excel 2007 and later
INDEX Formula Excel 2010 and later
ROW Formula Excel 2007 and later

I use array formula.
Select E2:E15
then write =IFERROR(INDEX($B$2:$B$15,SMALL(IF(IFERROR(MATCH($A$2:$A$15,$D$2,0),0),ROW(INDIRECT("1:"&ROWS($A$2:$A$15)))),ROW(INDIRECT("1:"&ROWS($A$2:$A$15))))),"")
then press Ctrl+Shift+Enter.

Related

Fill formula column wise when drag down by column in Excel

I want to fill up a column of values using xlookup(). Please see the example below.
Typically the formula will automatically change parameters as I drag down the column but it only works if Var1-Var6 are populated by rows. But in the raw data Var1-Var6 are in columns (and cannot be easily transposed due to other constrains). I am wondering how I can make the formula automatically loop through column B to G when dragging down the column.
Use INDEX:
=XLOOKUP($J$4,$A:$A,INDEX($B:$G,0,ROW($ZZ1)))
Now as it is dragged down it will change which column is returned.
with Office 365 we can also use filter and transpose:
=TRANSPOSE(FILTER(B:G,A:A=J4))
put that in the first cell and it will spill the results

Is there a way to drag formula down but changing the column

I'm trying to make a summary which list out all the matches and do a transpose of the table. I wrote a formula which works successfully. But, I come into another problem, which I find my formula cannot be dragged down and apply to all rows. Can anyone assist me in improving my formula?
Source:
Summary:
I would want to drag down the rows in "My summary" and the formula can do the columns+1 automatically. Appreciate for your help.
Here's my formula:
=IFERROR(INDEX(Sheet1!$F$9:$F$16, SMALL(IF(Sheet1!$H$9:$H$16="X",ROW(Sheet1!$H$9:$H$16)-ROW(Sheet1!H$9)+1),COLUMN(A1))),"")
In your screenshot it's difficult to tell which rows the data lives in. The following formula has been entered into Sheet2, cell B2 and copied down.
=IFERROR(TRANSPOSE(FILTER(Sheet1!$F$9:$F$16,INDEX(Sheet1!$H$9:$K$16,1,ROW(A1)):INDEX(Sheet1!$H$9:$K$16,8,ROW(A1))="x")),"")
Source screenshot Sheet1
Result screenshot Sheet 2
This approach uses Excel's Dynamic Array functionality, available only in Excel license with Office 365. The formula is only in column 2. It automatically spills its results into the neighboring columns as required.
edit after comment
If you don't have Office 365, you can use a variant of your formula, where the Index is replaced by and Index():Index() technique. The first Index pulls the first row, the second Index pulls the last row and the two results are combined with the range operator : that combines the two results into a range.
=IFERROR(INDEX(Sheet1!$F$9:$F$16,
SMALL(IF(INDEX(Sheet1!$H$9:$K$16,1,ROW(A1)):
INDEX(Sheet1!$H$9:$K$16,8,ROW(A1))="X",
ROW($A$9:$A$16)-ROW(A$9)+1),COLUMN(A1))),"")
Start in the first result cell (B2 in my screenshot) and use Ctrl+Shift+Enter to confirm, since it is an array formula. Then copy across and down.
Note: screenshot results are different, since I recreated the sample from scratch and the source data is different.

How could i arrange the following in excel

I have an excel sheet with the given date in Column A and B. I want to convert the same as shown on right side of the picture
If you wish to use formula approach, then please add this formula =IFERROR(INDEX($B$2:$B$14,SMALL(IF($D2=$A$2:$A$14,ROW($A$2:$A$14)-ROW($A$2)+1),COLUMN(A2))),"") in cell E2. When entering formula please use CTRL+SHIFT+ENTER combination, since this is array formula. After you confirmed formula, drag it across your area E2:H5.

Use calculated result to filter rows in Excel

Please excuse my english i'm not a native.
I have an issue in Excel. I'm trying to extract rows that are satisfying certain conditions. In the table
Table result must contain only rows where columns MS / MS / MRPC <> 90/90 / S09. I tried using the IF function but fail.
Can anyone help me, please, with this problem ?
Thank you
The way to reduce DB based on a criteria uses Array formulae and looped INDEX/MATCH functions. I have tried to recreate your table at my end in the example, as in the screenshot.
Your base data is assumed to be in A1:E11, and the resultant table I have is in A14 onwards. The logic is to reduce the no of Part nos based on criteria, and once we have this shortlist, we VLOOKUP the corresponding information.
In cell A15, use this code
A15 =INDEX($A$2:$A$11, MATCH(0, COUNTIF($A$14:$A14, $A$2:$A$11)+($C$2:$C$11=90)+($D$2:$D$11=90)+($E$2:$E$11="S09"), 0), 1)
and since this is an array formula, use Ctrl+Shift+Enter and excel will put curly brackets on its own.
Copy-paste this formula down until you see an #N/A, that's where the table will have no more to add.
Next step, is to VLOOKUP A15 in B15 by =VLOOKUP($A15,$A$1:$E$11,COLUMN(),0)
You can drag this formula for the rest of the table in columns up to E and down until the last valid row in the above step.
See screenshot for illustration. The whole deal is pasted as values in H:L for viewing as values.

Vlookup formula in excel

I was hoping someone could offer me a little help please on a formula. In one of my cells I use a vlookup to search for the colour in B12 and match it to the colour on another worksheet called cars.
Now this works perfectly fine, but after running the formula I have to select the last row of data and press control & d, or drag down the cell up until the last cell, my question is that is it possible to add this forumla into the cell and have it automatically run all the way down to the last row of data? my forumula is
=VLOOKUP(B12,coloursc:carsc,2)
You can use an Excel table for your data entry. Formulas and formatting will automatically be applied to any new row in the table. You no longer need to manually copy down or pre-fill empty areas of the spreadsheet with formulas.
Learn more about tables in this Microsoft article and this tutorial on Contextures.com

Resources