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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 16, 20262026-06-16T04:38:51+00:00 2026-06-16T04:38:51+00:00

This program is to convert a column of data from cumulative to non-cumulative. On

  • 0

This program is to convert a column of data from cumulative to non-cumulative. On my sheet I have A1, B1, and C1 with the text Non-Cumulative, Cumulative, and Converted, respectively. I have numbers 1 to 10 beneath A1, then them summed cumulatively beneath B1. C1 is where I want to convert column B back to non-cumulative.

The IsNumeric is used to make the first row of data in C equal to the first row of data in B. It should detect that the title is above the number it is evaluating, thus knowing that no calculations have to be performed. For the rest of them, it’ll see that the number above the one it is evaluating is a number, and thus the calculation has to be done.

My problem is that it isn’t working. I think the reason is because IsNumeric() keeps coming back as false. Is there a different function I should be using? Do cell references not work in IsNumeric?

Here’s the program!

Option Explicit

Dim i As Variant

Sub Conversion()

Sheets("Test Sheet").Select

For i = 1 To 10
    If IsNumeric("B" & i) = False Then
        Range("C" & i + 1) = Range("B" & i + 1)
    Else: Range("C" & i + 1) = Range("B" & i + 1) - Range("B" & i - 1)
    End If
Next

End Sub
  • 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-16T04:38:52+00:00Added an answer on June 16, 2026 at 4:38 am

    The way you wrote your code is logical, just a minor syntax changes you need initially. However,

    • It’s also best to check if the range is empty first…
    • Then check on if the value is numeric.
    • Better even, if you set the Range into a Range object and use offset

    Code:

    Option Explicit '-- great that you use explicit declaration :)
    
    Sub Conversion()
      Dim i As Integer '-- integer is good enough
      Dim rngRange as Range
    
      '-- try not to select anything. And for a cleaner code
      Set rngRange = Sheets("Test Sheet").Range("B1") 
    
        For i = 1 To 10
          If (rangeRange.Offset(i,0).value) <> "" then '-- check for non-empty
            If IsNumeric(rangeRange.Offset(i,0).value) = False Then
               rangeRange.Offset(i+1,1) = rangeRange.Offset(i+1,0)
            Else
               rangeRange.Offset(i+1,1) = rangeRange.Offset(i+1,0) - rangeRange.Offset(i-1,0)
            End If
          End if
        Next i '-- loop
    End Sub
    

    To make your code more dynamic:

    • Another suggestion, you may simply Application.WorkSheetFunction.Transpose() the entire B column range that you need to validate into a variant array
    • Process the array and Transpose back to the Range with column B and C.
    • By doing so, you may omit setting for loop size manually but setting it using Lower and Upper bound of the array 😉
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have this program that is reading the test string from a textbox and
I have this program that is feeding me data. I take this data (string)
I have a program that I want to convert from RPGIII to RPGIV. I
I have a c# .net program where I need to first insert data into
This program is to convert a base 4 number to a base 2 number
I have written this program which changes the entered height (in cm) to feet
I got a strange error with this program, It download a photo from internet,
I have the following python code : #This program converts the speeds 60 KPH
This program: from __future__ import division import numpy as np from scipy.optimize import minimize
I have some existing code that retrieves data from a database using ADO.NET that

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.