Formula for matching multiple row cell including blank cell - vba

Well, my question is, What is the formula for matching multiple row cell, if Match TRUE else FALSE then show the different row cell value in next column also sheet have blanks cell too so formula avoid blank cell and result is TRUE.
Please follow the sheet
I am using this formula:
{=AND(EXACT(A2:M2,A2))}
and this formula:
=IF(COUNTIF(A2:M2,A2)=13,"TRUE","FALSE")
But it match with blank cell, I need formula to only for existed matching row cell value then result is TRUE and FALSE. and if False then show that row cell column value in next column
Thanks
BN

The three standard formulas use in M2:O2 in the following image are,
=COUNTIF(A2:L2, A2)=COUNTA(A2:L2)
=IFERROR(INDEX(A2:L2, AGGREGATE(15, 6, COLUMN(A:L)/((A2:L2<>A2)*SIGN(LEN(A2:L2))), 1)), "")
=IFERROR(INDEX(A$1:L$1, AGGREGATE(15, 6, COLUMN(A:L)/((A2:L2<>A2)*SIGN(LEN(A2:L2))), 1)), "")
Fill down as necessary.
   
The conditional formatting rule for B2:L9 was based upon the following formula,
=AND(LEN(B2), B2<>$A2)

Related

Fill blanks with top cell

Given the following code, I would like to understand how it works:
Columns("A:A").Select
Selection.SpecialCells(xlCellTypeBlanks).Select
Selection.FormulaR1C1 = "=R[-1]C"
So what it currently does is it takes the top cell of the row and auto fills it down with formula =A1 relative to that cell on all blank cells below it.
However it stops at the next cell that contains a value and does the same treatment down all the cells below it till the next.
How does this work exactly? How does vba knows to take the formula from the cell above the blanks and not just from the first cell of the column?
Much help is appreciated!
This is how the code works:
Select the entire column A
Columns("A:A").Select
Now select just the blank cells in column A
Selection.SpecialCells(xlCellTypeBlanks).Select
Now for every cell we've selected (all the blank cells in column A), input a formula.
The formula roughly equates to: "Equals to the cell immediately above this cell."
Selection.FormulaR1C1 = "=R[-1]C"
The formula is using a relative cell reference, and it literally translates to "Equals Row-1, same Column."

Excel VBA Autofill across columns

I want to edit the range in Autofill code below but I'm not sure how.
'find last used cell in the row to the right
Range("B59").End(xlToRight).Select
'auto fill the formula for "Total TV"
ActiveCell.AutoFill Range(ActiveCell, ActiveCell.Offset(0, 1))
At present, the code finds the last valid cell in a row, then it autofills one cell to the right.
What I want to do:
I would to find the last valid cell, then select the active cell and the cells from 3 rows below it too and then autofill one cell to the right.
In pictures it would look like this:
find last valid cell in row 59:
select active cell and cells 3 rows below:
Autofill one cell to the right
Here is one way. No need to Select
Sub x()
Dim r As RANGE
Set r = RANGE("B59").End(xlToRight)
r.Resize(4).AutoFill r.Resize(4, 2)
End Sub

Excel VBA - Target.EntireRow excluding two columns

I am working on a spreadsheet that utilizes columns A:AV. I have it set to automatically copy and paste the entire row when a cell in column D has the text "Closed". I couldn't cut the row due to formatting that the sheet has, so instead I'm using this to clear the row Target.EntireRow.Value = "". My question is, is it possible to set the values of the entire row to "" while skipping over columns W and X? I have formulas in those columns that I don't want to be erased. Thanks for the help.
To clear all cells in a row except for columns W and X:
With Target.Parent
Union(.Range(.Cells(Target.Row, "A"), .Cells(Target.Row, "V")), _
.Range(.Cells(Target.Row, "Y"), .Cells(Target.Row, .Columns.Count))).ClearContents
End With

Excel: Check if cell string value exists in column, and get all cell references to that string

I suspect this may be a job for VBA, which is beyond my abilities. But here's the scenario:
Column A in Sheet 1 (CAS1) contains x rows of text values
Column A in Sheet 2 (CAS2) contains x rows of text values
Part A - For each row value in CAS1, I need to know if the string is contained in any of the cells in CAS2. Not exact match, the string can be only part of the searched cells.
Part B - I need to know the cell value of each cell in CAS2 that contains the CAS1 value (if they do exist, they can be listed in the cells adjacent to the cell being searched in CAS1).
I've tried the following to attempt Part A, all to no avail:
vlookup(A1,sheet2!A:A,1,false)
NOT(ISNA(MATCH(A1,sheet2!A:A,0)))
ISNUMBER(MATCH(A1,sheet2!A:A,0))
COUNTIF(sheet2!A:A,A1)>0
IF(ISERROR(MATCH(A1,sheet2!A:A, 0)), "No Match", "Match")
I know some of the cell values in CAS2 contain the cell values in CAS1, so I don't know why they return false or No Match. I suspect it may be down to the nature of the text content. So here's some sample data:
CAS1
LQ056
RV007H
RV008
RV009H
TSN304
TSN305
CAS2
RV009-satin-nickel-CO.jpg
STR314.jpg
STR315.jpg
HCY001.jpg
RV008-oval-rad-CO.jpg
HCY001-BRAC006.jpg
Any help would be appreciated.
This problem can be faced through VBA (at least, I imagine the VBA solution much more easily than the possible Excel one). You need a macro that, for each row in CAS1, search the content in each row of CAS2 and returns you the address.
For Each cell In Sheets("CAS1").Range("A1:A" & Sheets("CAS1").Range("A1").End(xlDown).Row) '<-- check each cell of the range A1:A? of sheet CAS1 (adapt "A" and "1" if they're different)
recFound = 0 '<-- count how many findings there are
For Each cell2 In Sheets("CAS2").Range("A1:A" & Sheets("CAS2").Range("A1").End(xlDown).Row) '<-- check in each cell of the range A1:A? of sheet CAS2 (adapt "A" and "1" if they're different)
If InStr(cell2.Value, cell.Value) <> 0 Then '<-- if the value in cell is contained in the value in cell2..
recFound = recFound + 1 '<-- account the new finding
cell.Offset(0, recFound) = Split(cell2.Address, "$")(1) & Split(cell2.Address, "$")(2) '<--write the address on the right of the currently searched cell
End If
Next cell2
Next cell
All the above should be enclosed in a macro, e.g. Sub makeMySearch(), that should be run to get the results. As commented in my code, I'm assuming that data are in A1:A? of both sheets; but they of course might be, for example, in B5:B? of the sheet 1 and in C7:C? of the sheet 2. You need clearly to adapt the code to your current data.
There's no need for VBA. Some simple array-formulas can do the job.
To see if the entry in CAS1 is present in CAS2:
=OR(ISNUMBER(SEARCH(A2,CAS2_)))
will return TRUE or FALSE. BUT this formula has to be entered by holding down CTRL-SHIFT while hitting ENTER If you do this correctly, Excel will place braces {...} around the formula that you can see in the formula bar.
The SEARCH function returns an array of results, which will be either the #VALUE! error, or a number.
In order to return the address, the following array-formula can be entered adjacent to a cell in CAS1:
=IFERROR(ADDRESS(LARGE(ISNUMBER(SEARCH($A2,CAS2_))*ROW(CAS2_),COLUMNS($A:A)),1),"")
Fill right for the maximum number of addresses possible, then select the group and fill down.
In this case, the array being returned is a string of either 0's, or 1 * the row number (i.e. the row number). I assumend the data in CAS2 was in column A, but you can change the column number if needed (or even compute it if necessary, by replacing the 1 in the ADDRESS function with COLUMN(CAS2_))
CAS1_ and CAS2_ are either named ranges, or absolute range references to the two text groups.

Clear all cells in column who = ""?

So, I have a script that is plotting data points for me, and I'm running into an issue where there are several blank spots in the data. Of of my columns is calculated, and I have a formula that sets it equal to "" if more than 0 cells that are used in the calculation are blank. The plots that use the blank cells work fine to show gaps in the data, but Excel doesn't evaluate a cell that has a formula that results in "" as blank.
Therefore, I need to set up some code that can search the entire column of data and clear the formula out of the cells whose value equal "", thereby making them blank and displaying as gaps in the plot.
I know I can use the Find and What commands to find the first cell that is evaluated as "", but how can I use it to find all the cells in the column?
The row range for the data is always constant, between 4 and 243, and the column number I am searching (within a loop) evaluates as 3*(iCounter - 1) + 2, if that helps anyone.
(The range I am searching is equal to Range(Cells(4, 3*(iCounter - 1) + 2), Cells(243, 3*(iCounter - 1) + 2))
Click on any cell in the column you wish to cleanup and run this:
Sub ClearThem()
Dim BigR As Range, r As Range
Set BigR = Intersect(ActiveCell.EntireColumn, ActiveSheet.UsedRange)
For Each r In BigR
If r.Value = "" Then r.Clear
Next r
End Sub