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

  • SEARCH
  • Home
  • 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 9097357
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T00:05:29+00:00 2026-06-17T00:05:29+00:00

I have an Excel 2007 spreadsheet populated with four columns (V1 V2, V3 V4)

  • 0

I have an Excel 2007 spreadsheet populated with four columns (V1 V2, V3 V4) that contain values (integers [0-20]) separated by a comma. Values need not be continuous.
Excel Spreadsheet: example data and output
I would like to create a new column (e.g. newV) whose cells only contains an integer if it is included in at least two of the previous four columns from that row. Can this be done with a formula or macro within Excel? If so what would be a good way to approach this? Thank you.

  • 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-06-17T00:05:30+00:00Added an answer on June 17, 2026 at 12:05 am

    If each value can only appear once in each cell:

    Function IfAtLeast(rng As Range, num As Integer)
        Const SEP As String = ","
        Dim c As Range, d As Object, arr, i As Long, tmp, k
        Dim rv As String
        rv = ""
        Set d = CreateObject("scripting.dictionary")
        For Each c In rng
            arr = Split(c.Value, SEP)
            For i = LBound(arr) To UBound(arr)
                tmp = Trim(arr(i))
                If Not d.exists(tmp) Then d.Add tmp, 0
                d(tmp) = d(tmp) + 1
            Next i
        Next c
        For Each k In d.keys
            If d(k) >= num Then rv = rv & IIf(Len(rv) > 0, ",", "") & k
        Next k
        IfAtLeast = rv
    End Function
    

    Usage:

    =IfAtLeast(A2:D2,2)
    

    EDIT: if you’re having problems trouble-shooting a UDF then it is often easier to debug the issue using a sub

    Sub Tester()
        debug.print IfAtLeast(Activesheet.Range("A2:D2"), 2)
    End Sub
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a large spreadsheet in Excel 2007 OpenXML format that I want to
I have an Excel 2007 ODBC connection defined and I need to allow users
I have an Excel 2007 spreadsheet with date entries in this format m/d/yyyy h:mm
I have an excel spreadsheet that has 8 connections. I would like to know
I have wrote a code that can read an excel 2007 file using Microsoft
I have created and Excel 2007 based dynamic charting application that that charts various
I have an Excel 2007 workbook that contains an ODBC data connection (to FoxPro,
I have an excel spreadsheet which contains a calendar control (Microsoft Calendar Control 2007,
I have an Excel add-in that I developed using Excel 2007 SDK, it works
I have exported excel 2007 document as CSV (separated by semicolon). I am using

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.