Fill empty cells with values from a list in another column - excel

I have the following Excel spreasheet:
A B C
1 =IF(B1<>"",B1;OFFSET(B1,-1,0)) CompanyA
2 =IF(B2<>"",B2;OFFSET(B2,-1,0))
3
4 CompanyB
5 CompanyC
6
7 CompanyD
In column B I have a list of different companies and it might happen that they are empty rows (in this case row2, row3 or row6) between the companies.
In column A I want to achieve that the empty rows are filled with the company names so in the end the spreadsheet looks like this:
A B C
1 Company A CompanyA
2 Company A
3 Company A
4 Company B CompanyB
5 Company C CompanyC
6 Company C
7 Company D CompanyD
I tried to use the If-formula with the offset in column A but it only works when there is not more than one empty row so it only works for CompanyB,C and D but not for company A.
Do you have any idea which formula I have to use in column A to solve this issue?

Pls refer the snap below
In A2 apply the below formula and drag down
=IF(B2<>"",B2,A1)
EDIT #1: Another method if data starts with row 1
if the data starts with B1 then apply the below formula in A1 and drag down
=IF(B1<>"",B1,IF(ROW()=1,B1,OFFSET(A1,-1,0)))

Provided the first cell, say B2, is not empty try with:=B2 in cell A2 and =IF(B3<>"";B3;A2)in cell A3 and fill down.

Related

Identify if list contains not unique values without countif in a helper column

A B C
1 Product A 1 Error
2 Product B 1
3 Product C 2
4 Product C 2
5 Product D 1
6 Product E 1
7
8
In the table above I want to identify if the values in Column A are unique.
If there is at least one value which is not unique Error should be displayed in Cell C1.
In order to achieve this I went with helper Column B and with the following formulas:
Column B `=COUNTIF($A$1:$A$6,A2)`
Cell C1 =`IF(COUNTA($A$1:$A$6)<SUM($B$1:$B$6),"Error","OK")`
All this works fine.
Now, I am wondering if there is also way to avoid the helper column.
Basically, a formula that goes through Column A and if it identfies at least one not-unique value it should display Error in Cell C1.
use:
=IF(MAX(COUNTIF($A$1:$A$6,$A$1:$A$6))>1,"Error","OK")
This is an array formula and depending on one's version will require the confirmation of Ctrl-Shift-Enter instead of Enter when exiting edit mode.
If one has the dynamic formula UNIQUE() then:
=IF(COUNTA(UNIQUE($A$1:$A$6))<>COUNTA($A$1:$A$6),"Error","OK")
As a normal formula.
Another formula, that will work in Conditional formatting:
=SUMPRODUCT(--(MATCH($A$1:$A$6,A:A,0)<>ROW($A$1:$A$6)))>0

Create a unique list even if original list contains cells with =""

I have the following Excel spreadsheet:
A B
1 Original List Unique List
2 Product A Product A
3 Product A Product B
4 Product B Product C
5 =""
6 Product A
7 Product C
8 Product B
9 =""
10 Product C
In Column A I have list which contains several products multiple times. My goal is now to create a list of all unique items in Column B.
To achive this I used the formula from this post in Cells B2:B10:
B2:B10 =IFERROR(INDEX($A$2:$A$10,MATCH(SUM(COUNTIF(B$1:B1,$A$2:$A$10)),COUNTIF($A$2:$A$10,"<"&$A$2:$A$10),0)),"")
and I get the following result:
A B
1 Original List Unique List
2 Product A
3 Product A Product A
4 Product B Product B
5 ="" Product C
6 Product A
7 Product C
8 Product B
9 =""
10 Product C
This result comes pretty close to the list I want. The only issue is that the formula cannot handle the formula ="" which is in some cells in Column A. Instead of starting the list in Cell B2 it starts the list in Cell B3.
How do I have to mody the formula so it also works in case there are cells with ="" in the original list?
Could you use excel's built in 'Remove Duplicates' function?:
Range("$A$2:$A$10").RemoveDuplicates Columns:=1, Header:=xlNo
We can use a "helper" column. In C2 enter:
=IF(A2="","",IF(COUNTIF($A$2:A2,A2)>1,"",1+MAX($C$1:C1)))
and copy down. Column C assigns a simple sequential value to each item in column A from which data will be extracted. Then in B2 enter:
=IFERROR(INDEX($A$2:$A$10,MATCH(ROWS($1:1),$C$2:$C$10,0)),"")
and copy down:
Note:
This method uses normal formulas rather than array formulas.
You could use the Advanced Filter.
Use a Formula criteria such as =LEN(A5)>0 where A5 is the first cell with data. And then check the Unique Records Only in the Advanced Filter dialog. You can either filter in place, or to a new location

Reference cells from column a where column b is atleast (value)

I am looking for a formula that can get me the reference of cells in "Column A" if "Column B" >= 2.
i.e.
Column A Column B
Company 1 1
Company 2 1
Company 3 3
Company 4 1
Company 5 5
Company 6 4
So in this example the output would be
Column A
Company 3
Company 5
Company 6
I am a bit confused on how to approach this, can you guide me in the right direction?
Both these answers use an array formula, so enter with Ctrl+Shift+Enter in first cell and drag down.
If your list starts on row 1 you can use:
{=IFERROR(INDEX($A$1:$A$6,SMALL(IF($B$1:$B$6>=2,ROW($B$1:$B$6),""),ROW(B1))),"")}
Otherwise use (this is for rows 10:15):
{=IFERROR(INDEX($A$10:$A$15,SMALL(IF($B$10:$B$15>=2,ROW($B$10:$B$15)-MIN(ROW($B$10:$B$15))+1,""),ROW(B1))),"")}

How to match columns and adding blank rows in excel

I have an excel file with 5 rows in column A and B, and 3 in column C and D (in reality though, I have a couple of hundreds of rows). Column B consists of text belonging to A, and D of text belonging to C. Column C has some of the values found in column A.
It looks like this:
A B C D
1 1 stringA1 1 stringC1
2 2 stringA2 2 stringC2
3 3 stringA3 4 stringC3
4 4 stringA4
5 5 stringA5
Now, I would like to match the numbers in column C with those in A, so that matches are put in the same row. For those rows in A for which there is no match in C, I want to have blank cells after column B.
It would look like this in this case:
A B C D
1 1 stringA1 1 stringC1
2 2 stringA2 2 stringC2
3 3 stringA3
4 4 stringA4 4 stringC3
5 5 stringA5
I have some idea that I should use VLOOKUP and maybe Conditional Formatting, but unfortunately I am not very experienced in excel. Could someone please suggest a way to do this?
Enter the following formula in Cell E1:
=IF(IFERROR(MATCH(A1,$C$1:$C$5,),"")<>"",INDEX($C$1:$D$5,IFERROR(MATCH(A1,$C$1:$C$5,),""),1),"")
and this one in Cell F1:
=IF(IFERROR(MATCH(A1,$C$1:$C$5,),"")<>"",INDEX($C$1:$D$5,IFERROR(MATCH(A1,$C$1:$C$5,),""),2),"")
Using Helper Column:
You can also do this using a helper column.
In Cell E1 write:
=IFERROR(MATCH(A1,$C$1:$C$5,),"")
Then in Cell F1 write:
=IF(E1<>"",INDEX($C$1:$D$5,E1,1),"")
And finally in Cell G1 write:
=IF(F1<>"",INDEX($C$1:$D$5,E1,2),"")
This was answered by #user3514930 to a question here.
You can directly use this formula in D2 and copy downwards:
=IF(A2 = C2, A2, "")
Now if you have formulas in A2, C2, type in those formulas in place of A2, C2 in the above.

A function that will lookup a reference

Before I get started thanks for taking your time and helping.
This is what my worksheet looks like:
Row # B C D E F
2 1 Product 1 B2 B3 B4
3 2
4 6
5 1 Product 2 B5 B6
6 5
7 4 Product 3 B7
I was trying to follow this formula: (The best answer one or green check mark) return values from multiple matching rows
I got all the way to the =IFERROR(INDIRECT(lookups!H5),"") but can not get this to work.
What I am tying to do is order the numbers in Column B to go to the right of the product. Which I was able to get the column it is in (B) and the row number it is in (B2). I would like to change the value (B2) to the number that is there.
I would like it to look like this:
Row # C D E F
2 Product 1 1 2 6
3
4
5 Product 2 1 5
6
7 Product 3 4
If someone could help explain this to me or find a better way that would be great.
Not sure what is to happen to columnB but if you replace B with "="B throughout columns D:F then select each of these in turn and apply Text to Columns with Tab as the delimiter the 'cell references' convert to formulae referring to the values in B. If you want to delete columnB copy D:F and Paste Special, Values over the top.

Resources