Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 1043737
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 16, 20262026-05-16T15:43:00+00:00 2026-05-16T15:43:00+00:00

I have a table with three fields (ID, Price, Date) in excel. It has

  • 0

I have a table with three fields (ID, Price, Date) in excel. It has four records as following:

ID Price  Date
1  $400   1/1/2010
2  $500   1/2/2010
3  $200   1/1/2010
4  $899   1/2/2010

I would like to take each value of the date and place it in a cell A2,A3,A4…. however, I want to take only unique dates and do not take any date that was already stored in a previous cell. For example, date 1/1/2010 should be stored in cell A2 and 1/2/2010 should be stored in cell A3. When it comes to the third record which is 1/1/2010 it should ignore it because a similar date was already found previously and so on.
Thanks for your help!

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-16T15:43:00+00:00Added an answer on May 16, 2026 at 3:43 pm

    Here’s some VBA code you can use to loop through the first sheet and copy only the first unique row to the second sheet. Your question asked for just the value to be copied, but this code copies the entire row. You could easily remove the unnecessary columns or modify the code.

    Option Explicit
    
    Sub Main()
        Dim wsSource As Worksheet
        Dim wsDestination As Worksheet
        Dim uniqueCol As String
        Set wsSource = Worksheets("Sheet1")
        Set wsDestination = Worksheets("Sheet2")
        uniqueCol = "C"
        CopyFirstUniqueValuesToOtherWorksheet _
            wsSource, _
            wsDestination, _
            uniqueCol
    End Sub
    
    Sub CopyFirstUniqueValuesToOtherWorksheet( _
        sourceSheet As Worksheet, _
        destinationSheet As Worksheet, _
        uniqueCol As String)
    
        Dim iRow As Long
        Dim iHeaderRow As Long
        Dim rngUnique As Range
        iHeaderRow = 1
        iRow = iHeaderRow + 1
    
        'Clear contents of destination sheet '
        ClearDestinationSheet sourceSheet, destinationSheet
    
        'Copy Header Row '
        CopyRow sourceSheet, destinationSheet, iHeaderRow
    
        'Loop through source sheet and copy unique values '
        Do While Not IsEmpty(sourceSheet.Range("A" & iRow).value)
            Set rngUnique = sourceSheet.Range(uniqueCol & iRow)
            If Not ValueExistsInColumn(destinationSheet, uniqueCol, _
              CStr(rngUnique.value)) Then
                CopyRow sourceSheet, destinationSheet, iRow
            End If
            iRow = iRow + 1
        Loop
    
    
    End Sub
    
    Sub CopyRow(sourceSheet As Worksheet, _
        destinationSheet As Worksheet, _
        sourceRow As Long)
    
        Dim iDestRow As Long
        sourceSheet.Select
        sourceSheet.Rows(sourceRow & ":" & sourceRow).Select
        Selection.Copy
        iDestRow = 1
        Do While Not IsEmpty(destinationSheet.Range("A" & iDestRow).value)
            iDestRow = iDestRow + 1
        Loop
        destinationSheet.Select
        destinationSheet.Rows(iDestRow & ":" & iDestRow).Select
        ActiveSheet.Paste
        sourceSheet.Select
    End Sub
    
    Sub ClearDestinationSheet(sourceSheet As Worksheet, _
        destinationSheet As Worksheet)
    
        destinationSheet.Select
        Cells.Select
        Selection.ClearContents
        sourceSheet.Select
    End Sub
    
    Function ValueExistsInColumn(sheet As Worksheet, _
        col As String, _
        value As String) As Boolean
    
        Dim rng As Range
        Dim i As Long
        i = 2
    
        Do While Not IsEmpty(sheet.Range(col & i).value)
            Set rng = sheet.Range(col & i)
            If CStr(rng.value) = value Then
                ValueExistsInColumn = True
                Exit Function
            End If
            i = i + 1
        Loop
    
        ValueExistsInColumn = False
    End Function
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a logging table which has three columns. One column is a unique
I have a table in SQL Server 2005 which has three columns: id (int),
I'm working on Oracle and Perl. I have three fields in a table (A,
I have a table with three columns: user varchar, status varchar , rep int
I have three columns in my table - company_name, first_name, last_name . In the
I have three tables in the many-to-many format. I.e, table A, B, and AB
In a table, I have three columns - id, name, and count. A good
I am trying to use the following query on a table with ~200k records
I have the following database table created thus: CREATE TABLE AUCTIONS ( ARTICLE_NO VARCHAR(20),
I would like suggestions how to solve the following demand. I have a table

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.