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 8191465
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 7, 20262026-06-07T03:55:32+00:00 2026-06-07T03:55:32+00:00

I will be referencing the below picture: I seek to split up the FirstValue

  • 0

I will be referencing the below picture:
enter image description here

I seek to split up the FirstValue Column into the two columns right of it; however, I want to split the columns based off the Parameter column. When the Parameter value is odd, I want to copy the values only to the OtherValue1 column. When the Parameter value is even, I want to copy the values only to the OtherValue2 column. After reading forums and trying excel’s “Text to Columns” feature, I am unable to find a solution.

Is there a way implement this using VBA?

*Note: The worksheet is actually about 10,000 rows long, so speed would also be helpful.

EDIT:
Here is the code I have so far. I am getting Object errors in this line of code: .Cells(2, MF1Col).Formula = "=IF(MOD(paraformula,2)=1,WTRfor,"")"

    Dim rw As Worksheet
Dim secondCell, MF1Cell, MF2Cell, paraCell, MF1formula, MF2formula, paraformula, WTRfor As Range
Dim secondCol As Long, MF1Col As Long, MF2Col As Long, paraCol As Long
 Set rw = ActiveSheet

With rw

    Set secondCell = .Rows(1).Find("FirstValue”)

    ' Check if the column with “FirstValue” is found

    'Insert Two Columns after FirstValue
    If Not secondCell Is Nothing Then
        secondCol = secondCell.Column
        .Columns(secondCol + 1).EntireColumn.Insert
        .Columns(secondCol + 2).EntireColumn.Insert
        .Cells(1, secondCol + 1).Value = "OtherValue1"
        .Cells(1, secondCol + 2).Value = "OtherValue2"
        .Activate

    Set MF1Cell = .Rows(1).Find("OtherValue1")
    MF1Col = MF1Cell.Column
    Set MF2Cell = .Rows(1).Find("OtherValue2")
    MF2Col = MF2Cell.Column
    Set paraCell = .Rows(1).Find("Parameter")
    paraCol = paraCell.Column

    Set paraformula = Range(.Cells(2, paraCol).Address(RowAbsolute:=False, ColumnAbsolute:=False))
    Set MF1formula = Range(.Cells(2, MF1Col).Address(RowAbsolute:=False, ColumnAbsolute:=False))
    Set WTRfor = Range(.Cells(2, secondCol).Address(RowAbsolute:=False, ColumnAbsolute:=False))
    .Cells(2, MF1Col).Formula = "=IF(MOD(" & paraformula & ",2)=1," & WTRfor & ","""")"
    Range(.Cells(2, MF1Col).Address).Select
    Range(Selection, Selection.End(xlDown)).Select
    Selection.Copy
    ActiveSheet.Paste

    Set MF2formula = Range(.Cells(2, MF2Col).Address(RowAbsolute:=False, ColumnAbsolute:=False))
    .Cells(2, MF2Col).Formula = "=IF(MOD(" & paraformula & ",2)=0," & WTRfor & ","""")"
    Range(.Cells(2, MF2Col).Address).Select
    Range(Selection, Selection.End(xlDown)).Select
    Selection.Copy
    ActiveSheet.Paste   

End If
End With
  • 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-07T03:55:34+00:00Added an answer on June 7, 2026 at 3:55 am

    in C2, =IF(MOD(E2,2)=1,B2,"")
    in D2, =IF(MOD(E2,2)=0,B2,"")

    copy these down to the end of your data

    assuming the same format (Data,Col1,Col2,Parameter), but using relative addressing
    Column 1: =IF(MOD(OFFSET(C2,0,2),2)=1,OFFSET(C2,0,-1),"") replace C2 with the current cell
    Column 2: =IF(MOD(OFFSET(D2,0,1),2)=0,OFFSET(D2,0,-2),"") replace D2 with the current cell

    again, copy and paste – once you have the first one correct, excel will adjust the formula for the current cell

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm referencing my JavaScript files before the closing body tag, hoping they will be
Referencing Spring documentation : Any RuntimeException will trigger rollback, and any checked Exception will
I will use model.id when referencing the id for the table in the database,
If I avoid referencing assemblies that don't exist in the silverlight 2.0 runtime, will
I want to load a xsd file that is stored in: /WEB-INF/myxsd.xsd I will
If I have a view that I will be referencing with decent regularity (to
Will the following code cause a ConcurrentModificationException or other side effects? ArrayList<String> newList =
Will my windows-7, command prompt allow me to filter memory logcat messages for my
Will a thread stop if I send it SIGTSTP signal? Or in other words
Will the events that I added to the global event bus deleted by calling

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.