Consulting

Page 1 of 2 1 2 LastLast
Results 1 to 20 of 23

Thread: VBA Duplicate Name Check and Calculating the Values

  1. #1
    VBAX Regular
    Joined
    Oct 2008
    Posts
    28
    Location

    Cool VBA Macros Problem

    Hai

    I am New to VB Macros . I want to Check the Duplicate Value in the Excel Value Using Macro VB editor

    Eg:

    If the 1 St Row Contains Name as " VB" and the Value For Vb is 30
    2 nd Row Contains the Same Name "VB" and the Value for this is 20.

    I want to Remove the Duplicate Name and I want the output like this

    VB and the Value is 50 (30+20)

    Can Anyone Tell How can I Get this? Can AnyOne Send me the Code for Adding the Value After Checks the Duplicate Name

    I Written One Method that Generates the Values in the AboveSheet. I want to Check the Duplicate Value in the Sheet

    Thanks in Advance

    Kumar

  2. #2
    VBAX Regular
    Joined
    Oct 2008
    Posts
    28
    Location

    VBA Duplicate Name Check and Calculating the Values

    Hai,

    I am New to VB Macros .

    I want to Check the Duplicate Value in the Excel Value Using Macro VB editor
    Please Open My Attachments for Further Information.

    Thanks a lot

    Kumar


  3. #3
    Distinguished Lord of VBAX VBAX Grand Master Bob Phillips's Avatar
    Joined
    Apr 2005
    Posts
    25,446
    Location
    I did this for you in the Mac group.
    ____________________________________________
    Nihil simul inventum est et perfectum

    Abusus non tollit usum

    Last night I dreamed of a small consolation enjoyed only by the blind: Nobody knows the trouble I've not seen!
    James Thurber

  4. #4
    VBAX Regular
    Joined
    Oct 2008
    Posts
    28
    Location
    Hai But want to Satisfy all the Above conditions in that Column that i send ,As i am New to Vb Macros i cant Understand the Code Fully

  5. #5
    Distinguished Lord of VBAX VBAX Grand Master Bob Phillips's Avatar
    Joined
    Apr 2005
    Posts
    25,446
    Location
    [VBA]

    Public Sub ProcessData()
    Dim LastRow As Long
    Dim iRow As Long
    Dim i As Long

    With ActiveSheet

    LastRow = .Cells(.Rows.Count, "A").End(xlUp).Row
    For i = LastRow To 1 Step -1

    iRow = Application.Match(.Cells(i, "A").Value, .Columns(1), 0)
    If iRow <> i Then

    .Cells(iRow, "C").Value = .Cells(iRow, "C").Value + .Cells(i, "C").Value
    .Cells(iRow, "E").Value = .Cells(iRow, "E").Value + .Cells(i, "E").Value
    .Cells(iRow, "G").Value = .Cells(iRow, "G").Value + .Cells(i, "G").Value
    .Cells(iRow, "I").Value = .Cells(iRow, "I").Value + .Cells(i, "I").Value
    .Cells(iRow, "K").Value = .Cells(iRow, "K").Value + .Cells(i, "K").Value
    .Cells(iRow, "M").Value = .Cells(iRow, "M").Value + .Cells(i, "M").Value
    .Rows(i).Delete
    End If
    Next i
    End With

    End Sub
    [/vba]

    and no, you can't have my email, this is a community forum.
    ____________________________________________
    Nihil simul inventum est et perfectum

    Abusus non tollit usum

    Last night I dreamed of a small consolation enjoyed only by the blind: Nobody knows the trouble I've not seen!
    James Thurber

  6. #6
    VBAX Regular
    Joined
    Oct 2008
    Posts
    28
    Location
    this Code Shows Error in the
    iRow = Application.Match(.Cells(i, "A").value, .Columns(1), 0) . In this Line. As i am New to VB Macros , I cant Know the Reason. Please Help me

  7. #7
    Mac Moderator VBAX Expert shades's Avatar
    Joined
    May 2004
    Location
    Kansas City, USA
    Posts
    638
    Location
    Howdy. Is this specific to the Mac?

    Software: LibreOffice 3.3 on Mac OS X 10.6.5
    (retired Excel 2003 user, 3.28.2008 )
    Humanware: Older than dirt
    --------------------
    old, slow, and confused
    but at least I'm inconsistent!

    Rich

  8. #8
    Moderator VBAX Wizard Aussiebear's Avatar
    Joined
    Dec 2005
    Location
    Queensland
    Posts
    5,217
    Location
    Normally when a line errors out, it will give you the option of getting "help", what did it suggest to you?

    Secondly, while you took the trouble to provide some data within a word doc, why not post your data as an Excel workbook? We should not have to re construct your workbook for you.
    Remember To Do the Following....
    Use [Code].... [/Code] tags when posting code to the thread.
    Mark your thread as Solved if satisfied by using the Thread Tools options.
    If posting the same issue to another forum please show the link

  9. #9
    VBAX Regular
    Joined
    Oct 2008
    Posts
    28
    Location

    VBA Macros

    Look at the WorkSheet. In the First Sheet(Occupancy Consultant Report) , row 10,11 is the Same Name with Different Values . I want to Remove the Duplicate Name after adding the values . I want to Add the % Change Values . Can Anyone Modify that One and Send you .

    Thanks

    Quote Originally Posted by Aussiebear
    Normally when a line errors out, it will give you the option of getting "help", what did it suggest to you?

    Secondly, while you took the trouble to provide some data within a word doc, why not post your data as an Excel workbook? We should not have to re construct your workbook for you.

  10. #10
    VBAX Regular
    Joined
    Oct 2008
    Posts
    28
    Location
    Its Related To VBA Macros
    Quote Originally Posted by shades
    Howdy. Is this specific to the Mac?

  11. #11
    Moderator VBAX Wizard Aussiebear's Avatar
    Joined
    Dec 2005
    Location
    Queensland
    Posts
    5,217
    Location
    You want us to add the values from row 11 to row 10????
    Remember To Do the Following....
    Use [Code].... [/Code] tags when posting code to the thread.
    Mark your thread as Solved if satisfied by using the Thread Tools options.
    If posting the same issue to another forum please show the link

  12. #12
    VBAX Regular
    Joined
    Oct 2008
    Posts
    28
    Location
    In the Excel Sheet I want to Remove the Duplicate Name after Adding the Values .

    Eg: In Row 10 and 11 the Names is Same . I want the Output As follows
    Column3 Column5 Column7 Column 9 COlumn 11 Column13
    101 Cal: 77+-=77 103+-=103 103+-=103 -+-=- 103+-=103 N/a+N/a/2 =N/A

    Please Help me

    Quote Originally Posted by Aussiebear
    You want us to add the values from row 11 to row 10????

  13. #13
    Moderator VBAX Wizard Aussiebear's Avatar
    Joined
    Dec 2005
    Location
    Queensland
    Posts
    5,217
    Location
    Well the data sheet I opened has no data in row 11.
    Remember To Do the Following....
    Use [Code].... [/Code] tags when posting code to the thread.
    Mark your thread as Solved if satisfied by using the Thread Tools options.
    If posting the same issue to another forum please show the link

  14. #14
    VBAX Regular
    Joined
    Oct 2008
    Posts
    28
    Location
    Please Check the Row 10 and 11 in Occupancy Consultacy Sheet(Sheet1) .

    Quote Originally Posted by Aussiebear
    Well the data sheet I opened has no data in row 11.
    Last edited by yapmadhu; 10-31-2008 at 11:40 PM.

  15. #15
    Mac Moderator VBAX Expert shades's Avatar
    Joined
    May 2004
    Location
    Kansas City, USA
    Posts
    638
    Location
    Then I will move it to the general Excel forum. Since this forum is for Mac specific VBA.

    Software: LibreOffice 3.3 on Mac OS X 10.6.5
    (retired Excel 2003 user, 3.28.2008 )
    Humanware: Older than dirt
    --------------------
    old, slow, and confused
    but at least I'm inconsistent!

    Rich

  16. #16
    Moderator VBAX Wizard Aussiebear's Avatar
    Joined
    Dec 2005
    Location
    Queensland
    Posts
    5,217
    Location
    I have for a second time. And I reiterate - there is no data in row 11 to add.
    Remember To Do the Following....
    Use [Code].... [/Code] tags when posting code to the thread.
    Mark your thread as Solved if satisfied by using the Thread Tools options.
    If posting the same issue to another forum please show the link

  17. #17
    VBAX Regular
    Joined
    Oct 2008
    Posts
    28
    Location
    HAi in tenth row , value is 77 and in the 11 th row , the value is - . I want the output as 77+-=77 . If Suppose in the 11 th row , the value is 3 means , i want the Output as 77+3=80 . I want the Same output for the the Remaining 5,7,9,11 and 13 columns . In 13 th column , there is the % Value . So that i want to add the two Values and its Divided by 2 . ie . if 10 th row contains 20 % and 11 th row Contains 10 % Means , i want the Output as (20+10)/2= 15%

    Thanks

    Quote Originally Posted by Aussiebear
    I have for a second time. And I reiterate - there is no data in row 11 to add.

  18. #18
    Knowledge Base Approver VBAX Guru GTO's Avatar
    Joined
    Sep 2008
    Posts
    3,368
    Location
    Greetings Kumar,

    It was unclear to me at least if you are talking about strings (like: "Vb30") in one cell, or if these are side-by-side; as well as I'm not sure if you are talking about the "second row" in the same column?

    Could you maybe attach an example workbook where what you are aiming at would be easier to see?

    Thanks so much,

    Mark

  19. #19
    VBAX Regular
    Joined
    Oct 2008
    Posts
    28
    Location
    See the Sample Attachement . It Deletes the Duplicate Name After Adding the Values . The Same Thing want to Appply in the Original Excel Sheet .


    Quote Originally Posted by GTO
    Greetings Kumar,

    It was unclear to me at least if you are talking about strings (like: "Vb30") in one cell, or if these are side-by-side; as well as I'm not sure if you are talking about the "second row" in the same column?

    Could you maybe attach an example workbook where what you are aiming at would be easier to see?

    Thanks so much,

    Mark
    Last edited by yapmadhu; 10-31-2008 at 10:56 PM.

  20. #20
    VBAX Regular
    Joined
    Oct 2008
    Posts
    28
    Location
    Look at the 10 th and 11 th row in Occupancy Consultant Sheet . the Name are Same (101 California ..) . I want to Remove the Duplicate Value in the Excel Sheet . Also i want to Add the Two Values in Column 3,5,7,9,11,13 .

    For Eg : In Column 3 , I want the Value as 77+- = 77
    In Column 5 , I want the Value as 103+- = 103
    In Column 7 , I want the Value as 103+- = 103
    In Column 9 , I want the Value as - + - = -
    In Column 11 , I want the Value as 103+- = 103
    In Column 13 , I want the Value as (N/A+N/A)/2 = N/a

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •