Quantcast
Channel: Active questions tagged excel - Stack Overflow
Viewing all articles
Browse latest Browse all 88868

Generate the number of "(x,y)" data in a cell with reference to a number

$
0
0

(eg: 1=(x1,y1), 3=(x1,y1,x2,y2,x3,y3)

How do i remove the unnecessary "(,)" as shown below and put the number of position of the x,y coordinates of the reliability fail with reference to the number under the header of reliability fails? Eg: Reliability fail counts =2 in device WLR8~LW~VBD~MNW should give me the position of that fail counts at the same row as the device at columnX. Anyways please ignore the data under the V and W column in my pictures.

Current output based on my codeenter image description here

What i really wantenter image description here

Current issue enter image description here

Current issue2 enter image description here where it should be enter image description here

Dim output As Variant
Dim outputrow As Integer
output = ""
outputrow = 0
Dim ws1 As Worksheet
Set ws1 = ThisWorkbook.Sheets(1)

Dim ia As Long
Dim lastrow2 As Long
lastrow2 = ws1.Range("U2:U"& ws1.Rows.Count).Find(What:="*", SearchDirection:=xlPrevious, SearchOrder:=xlByRows).Row

If ws1.Range("U1") = "Reliability Fail" Then
 For ia = 2 To lastrow2
    If ws1.Cells(ia, "U").Value = 0 Then
    output = output & "("& ws1.Cells(ia, "Y").Value & ","& ws1.Cells(ia, "Z").Value & "),"
    ElseIf output = "(,)," Then 'if there are no x and y values in Y and Z column stop showing "(,),"
    output = ""
    End If
    If ws1.Cells(ia, "U").Value > 0 Then
    ws1.Cells(ia, "U").Offset(0, 3).Value = Left(output, Len(output) - 1) 'extract the x and y values obtain in (x,y) format
                    'if there is "value" under reliability fails(column U), put the x y position at the same row as the "value" at column X
    End If
    Next
End If

Viewing all articles
Browse latest Browse all 88868


<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>