Hi I'm a complete noob to excel and looking to do something like this:
For each item in column A
Get its corresponding value in column B and populate in column D
get its corresponding value in column C and populate in column E
the main problem I'm having is the number of rows in each column may differ.
I think I would need a macro to do this.
How could I do this in Excel?
If you don't want to resort to a macro and the presence of something in column A dictates when you want to see something in column D & E, then consider the following functions:
IsBlank( A1) returns true if A1 is empty else false.
If( condition, trueResult, falseResult) returns the corresponding result based on the condition.
So for example, you could write the formula for D1 to be:
=If( IsBlank(A1), "", B1 * 2)
would set D1 to be twice that of B1. You can now copy and paste that formula down the D column to as far as you need and because the formula uses relative addressing (B1 instead of $B$1) the formula is updated for each cell to work on the corresponding row.
If this doesn't solve your issue then more detail on your problem would be useful.
Related
Could you please help me for below formula little bit complicated
Problem is
In a sheet I have three column A,B,C any one column amount if it is same in D column need to highlight and show which column A or B orC..
Example
A B C D amount in each row
4 5 7 4 please highlight bez a and d match
Next example
5 3 6 2 should not highlight show error msg
In above case D is matching same number with AorBorC
Please help me this logic formula
Formula
=If(countif(A1:d4)=1, "duplicate","unique")
working fine but is there any possibility to show which cell column A or B or C ... If duplicate which column need to mention
Much appreciated for this complicated formula am not sure whether it required VBA here
Your question mentions "Highlight", so here's that part of the solution. Select your first 3 columns of data (A1:C6 in my case). Then go to Conditional Formatting in the Home Tab. Create New Rule, using a Formula to determine which cells to format.
Here's the formula:
=A1=$D1
Change the format fill to your color of choice. Click OK.
EDIT - Adding the last piece here...
Lastly, to display which column(s) match column D value, you could use a formula such as this.
Cell E1 Formula:
=CONCAT(IF(A1=D1,"A",""),IF(B1=D1,"B",""),IF(C1=D1,"C",""))
Drag it down.
XLOOKUP unlike VLOOKUP returns a reference to the cell and not just the value of the cell.
With this in mind =XLOOKUP(D2,A2:C2,A2:C2,NA()) will return the value if it exists as well as the reference.
If we wrap the Return Array with the Column function it will return the column number.
=XLOOKUP(D2,A2:C2,COLUMN(A2:C2),NA())
Add the ADDRESS function to return the cell address (this will return the address on row 1)
=XLOOKUP(D2,A2:C2,ADDRESS(1,COLUMN(A2:C2),4),NA())
Now substitute the 1 in the cell address with a blank:
=SUBSTITUTE(XLOOKUP(D2,A2:C2,ADDRESS(1,COLUMN(A2:C2),4),NA()),"1","")
I need to compare the date of a cell against a column that has multiple date and I see which one it matches and get the associated value. Here I put an image to explain myself better:
Column D is where I need to put the formula, which compares the dates in column A on sheet 1 with the dates in column A on sheet 2. If it matches, I need to multiply the values in column C on sheet 1 by the values in column B of sheet 2.
Here another image with an example to be clearer
I have a little idea that would be something like:
= YES (ERROR (MATCH (Sheet1! A4; Sheet2! A2: A32; 0)); Sheet1! C4 * X
In the x it should go B3, but I don't know how to get that cell in the search above.
Try this:
=VLOOKUP(A3,sheet2!A:B,2)*C3
I have recreated your spreadsheets below.
I have the following structured table in excel where 1000s of rows included.
I want to return the Last Cell Value of Column B for Each value in Column A.
For example:
For Cell A1 -> I want to return the Cell B5.
For Cell A6 -> I want to return the Cell B9.
I have tried with VLOOKUP, HLOOKUP, INDEX likewise so many formulas where I ended with more conflict situations. Can anyone please write down a Formula to give my requirement a life?
Array formula (Press Control + Shift + Enter while entering the formula) in cell C1 and copy it down.
=IF(A1="","",IFERROR(INDEX($A2:$B$20,MATCH(FALSE,ISBLANK($A2:$A$20),0)-1,2),LOOKUP(2,1/(B2:$B$20),B2:$B$20)))
if you don't mind using column C as a helper column you could use something like that:
If you won't use Array formula you can Use this solution:
like this image:
use column C as helper with this formula in first cell =OFFSET(A1;SUMPRODUCT(MAX(($A$1:$A1<>"")*(ROW($A$1:$A1))))-ROW(A1);0)
and use this formula in column D's first cell =IF(A1="";"";INDEX($B$1:$B$13;SUMPRODUCT(MAX((ROW($A$1:$A$13))*($C$1:$C$13=A1)))))
and copy fill-down to all cells.
Try this shorter, without helper column and non-array formula solution
In C1, formula copied down :
=IF(A1="","",INDEX(B1:B$9,MATCH(1,FREQUENCY(1,0+(A2:A$9<>"")),0)))
I have been trying this for days, and can't get it correct.
I want to see if any value in column A matches any value in column C, and if so, return the value from column B into column D, BESIDE the match in column C.
I have tried all the suggestions for If, IFERROR, MATCH, VLOOKUP, etc, but can't get it to work. Any help would be most welcome!!
Here is a picture of my spreadsheet
Use a helper column:
In column D, use COUNTIF on each row to check the number of times that a cell in column A appears. =COUNTIF(C:C,A1).
In column E, use the formula =IF(D1>0, B1,"") and copy down
(you could of course combine these if you don't want to use the extra column)
Assuming you're starting in Row 1, in column D use:
=IF(COUNTIF($A:$A,$C1)>0,B1,"NO MATCH")
Drag that down as far as you need. This formula is saying: if the value in C1 matches anything in column A, then return the value from B1.
If this isn't what you mean, then please be clearer. Your data example is unreadable. Post a screenshot, or at least type it so it is in columns and rows. It's also unclear what you mean by "BESIDE the match in column C" What value is matching which value? That is, if A1 matches any value in C, do you want the value of B1 to show up in D1? Or do you want the value of B5 to show up in D5, if A1 matched C5?
In coumn D use formula
=IFERROR(VLOOKUP(C:C,A:B,2,0),"")
Note: this formula uses Implicit Intersection see here for some info
I'm using a vlookup to look for the all cells in the column D and see if they got a positive match in the C cells. If yes, I'm putting what is in the B cell next to the C cell.
In the example below, E2 will have what is inside of B2 after a lookup on D2 in the C column.
I've tried this formula but it is not the good one
=VLOOKUP(D2,C:C,0,FALSE)
I hope I don't need VBA
Best.
It is not completely clear exactly what you are looking for. I think you are trying to lookup data in column B based on a key in column C. If so what you want to use is
=INDEX(B:B,MATCH(D2,C:C,0))
As a breakdown, the MATCH will return a number representing which row within the range C:C matches the key D2. And, INDEX returns the element in B:B at row MATCH(D2,C:C,0).