Number Variable: Keep Adding 24 When The Value Return To 0

May 3, 2007

I have few range of data that may range from 0 to 24 and the return to "0 " after 24 and the 2nd set of value keep repeating 0 to 24, but I would like to keep adding 24 when the value return to 0 and if the number less than 5 will be adding 24 and the number from 6 to 8 will be equal to 11 and also the number from 9 to 23 will not change. I have attached an example that Colum A needed to be converted to column B (which I done it manually).

View 2 Replies


Adding Dim'd Variables: Ignoring Strings & Adding Number

Jan 13, 2007

I've got a problem involving several Dim'd Variables needing to be added up, they're all Dim'd as Variants though as they can be either strings or numbers at any time.

I need a formula (VBA) to add them up (to add their actual numeric values - not just a "1" if they contain a number) and ignore them all together if they contain string values.

View 9 Replies View Related

Insert A Variable Number Of Rows And Copy And Paste From And To Variable Positions

Aug 8, 2009

On the attached Excel file, I have code that will insert a variable number of rows and copy and paste from and to variable positions. That all works fine when run from a command button, but when I try to run it from the Worksheet_Calculate by entering 1 in J1 or K1 (inrange cell is J1+K1 for testing purposes) the CommandButton1_Click sub runs continously until an error occurs.

View 4 Replies View Related

Adding A Variable Range

Nov 20, 2008

Per attached I have a range of columns (variable) which I need to sum, the number of rows are also variable. I have defined the variables:


I have tried the following code which isnt quite working.

View 3 Replies View Related

Adding Variable To Autofill

Jul 9, 2014

The cells A2:A25 are merged in my excel sheet and I would like to create subsequent merged cells below the A2:A25 set; however, I would like the user to determine the number of merged cell boxes.

The code I have written is as follows:

Dim lr As Long
lr = Application.InputBox("How many days was the monitor deployed?", Type:=2)
If lr = 0 Then Exit Sub Else lr = lr

Selection.AutoFill Destination:=Range("A2:A" & lr * 24), Type:=xlFillDefault
Range("A2:A" & lr * 24).Select

End Sub

So I am creating a macro where the user opens a message box and types in a value representing the number of days. That value is then calculated into an autofill equation but I keep getting an error.

View 7 Replies View Related

Adding A Variable Rows Worksheet

Mar 31, 2009

Due DateInvDocument numberDebitCreditBalance

The above is a part of a w/sheet. Rather than determining the last row in the debit column and credit column (to know which is greater) and use a loop to put a formula in each of the cells in the balance column (adding the debit and credit), I know I can use the with ... statement to input the formula at a go , but cannot figure it out.

Sub sumtotal()
With Sheets(1)
With .Range("G14", Range("G" & Rows.Count).End(xlUp))
.Formula = "=sum(E14+F14)"
On Error Resume Next

End With
End With
End Sub

View 9 Replies View Related

Adding Currency To Variable Range Of Cells?

Oct 24, 2012

I'm trying to create a sum that gives the output with the currency format but also change column D from from D2 to the Total the currency format. (it changes based on how many customers). Here is the code


Dim rng As Range
Set rng = Sheets("Sheet1").Range("D65536").End(xlUp).Offset(1, 0)
Range("D" & lastrow + 4).Select
lastrow = Cells(Rows.Count, 1).End(xlUp).Row
Cells(lastrow + 1, 4).Formula = "=sum(D2:D" & lastrow & ")"
rng.Select ("D" & lastrow)
Selection.NumberFormat = "$#,##0.00"

I know it has to do with the statement but I'm just not sure how to make it work for all of Column D from D2 to the Total/Sum.

View 2 Replies View Related

Adding A Constant To Sets Of Rows Of Variable Size

Jul 30, 2009

I have data from 100 trials. Each trial has a variable number of data points (rows), but each row is labeled in the first column with the trial number. I would like a macro to identify the first row of each trial, calculate the difference of the value of the cell in column G of that row from a constant (718), and then add that difference to that cell and all other cells in that column of that trial.

So based on the attached sample, I would like all values in column G for trial 2 to be +1, for trial 3 to be -5, and for trial 4 to be +2.

In the file, I've cleared all the data from the impertinent columns. Eventually, I will also want to perform a similar process on column H but with a different constant.

View 2 Replies View Related

Adding Variable To Specific Sheetname In A Sumif Function

Feb 4, 2010

Hi, looking for help desperately in fine tuning a formula. I have a formula at the moment (which works) for searching through a list on a separate file and totalling up all values which relate to it, see below:


The tab ‘1’ in the formula relates to the first of the month so this month there are 28 different tabs with similar information.

With C10 containing the date in this instance, does anybody know a way of making ‘1’ a variable so that entering ‘04/02/10’ would change it automatically into a 4? (Unfortunately for me changing the 1 to =c10 didn’t work).

View 14 Replies View Related

Set Range Variable Using Variable Row Number

Mar 11, 2008

I am using a variable named " Totals" as a range type to refference the range in a formula. It works the way I have it.

Dim Totals As Range
Set Totals = [U37: AE37]

Now instead of the absolute refference, I would like to change the row refference by an offset of my current row, using a formula with a varriable. The columns stay the same.

View 3 Replies View Related

Return Variable From Function

Jan 28, 2009

I've searched for an example of function that returns a variable, however, I'm unable to find one other than the one just has return variable on the end. I was wondering what I have wrong in the following code. This is placed in a module to make it available to all my worksheets.

Public Function findLR(Worksheet, Column) As Integer
LR = Worksheet.Cells(Rows.count, Column).End(xlUp).Row
return LR
End Function

View 9 Replies View Related

Return Variable From Other Procedure

Jan 19, 2008

I've search here for a bit and could not find the answer to what I'm looking for. I have 2 procedures on the same worksheet. I need to get the value of a variable from a second procedure so that my first procedure can work with it. From the first procedure I call the second, where the value of the variable is calculated, but when I return to the first procedure, the value of the variable seems to get lost.

View 6 Replies View Related

Variable Selection To Return Highest Value

Dec 12, 2011

If the weight selected is between the ranges e.g 1.5kg for England so that it returns the higher value 10.69. At the moment if I put in the vlookup formula it returns the lower value of 9.60.

Weight KGEnglandScotlandWales0.

View 4 Replies View Related

Return Subtotal Result To Variable

Nov 28, 2007

I seem to be having a little trouble with some of my code. It has worked previously without error. The variables CMvN and SkMvN are DIMed globally. The only thing that I recall that I have changed is that I have changed them from Double to Long. Changed it back to test and still experiencing problem.

' Filter named range using a named range on another sheet
Range("FilterRange").AdvancedFilter Action:=xlFilterInPlace, CriteriaRange:=Range("NormalMetroAM"), Unique:=False
CMvN = WorksheetFunction. Subtotal(101, Range("Cancelled"))
SkMvN = WorksheetFunction.Subtotal(101, Range("Skipped"))

When I put a break point in above it then enter:

? WorksheetFunction.Subtotal(101, Range("Cancelled"))

in the immediate window, the correct value (e.g. 8.57142857142857E-02) is returned. However, when I step through the code and go for example from CMvN line to SkMvN, the value isn't assigned to CMvN.

View 4 Replies View Related

HLookup Find Minimum Number In Row Then Return Left Most Number?

Mar 1, 2012

Items in Column A1 are calculated by (B2/4+5)*1.4 Items located under the columns 2000, 3000, 4000, etc... 10,000 are calculated by taking the top number, eg 2000/(A1 cell value)+the column B number. 2000/7+0 = 286 (rounded numbers)

I need to find an way to look up for x number (2000,3000,4000, etc...) find the smallest number in that column and then return the value in column A1.

A1 Number >2000300040005000600070008000900010000
70 2864295717148571000114312861429
84 24236148059971883795610751194


View 2 Replies View Related

If Number Falls Within Criteria - Return Alpha Number

Apr 23, 2012

I am trying to write a formula, I have 6 sets of criteria with a lower and higher range, if the number falls within the criteria I would like it to return the Alpha number,

eg, 104, will return D


View 7 Replies View Related

Return SUM Of Variable Cell Across Multiple Worksheets

Oct 26, 2012

I am trying to return the SUM of a variable cell across multiple worksheets... This 3D formula works

=SUM('March 2012:December 2013'!E27)

I wanted the formula on the next row to ref F27 then G27 etc... (which I can't just drag down) so thought I'd try to "assemble" the formula I wanted using the INDIRECT function...

I tried this formula which doesn't seem to work...


NOTE: the script in the INDIRECT brackets returns the text string... 'March 2012:December 2013'!E27

Can INDIRECT not handle multisheet references?

View 9 Replies View Related

Sumifs - Formula To Return Sum Based On 2 Variable

Sep 17, 2013

I am trying to work out a formula to return a sum based on 2 variable, but one of the variables in in a column and one in a row, anyway I can do this?

I don't want a normal sumif returning the relevant column as the relevant column will change based on a cell that can change.

I basically have a list of products sold (products listed down the page) by month (month listed across the page), I want to sum all the products in a particular month on a separate tab (both product and month can be changed).

View 8 Replies View Related

Index Match Lookup, Variable Return Column

Sep 3, 2009

I would imagine that the title of this thread made little sense, so let me try to explain:

Sheet A has columns A-C populated with data. Column D needs to search Sheet B columns A-C for a match. (ie, see if the data on sheet A is also on sheet B) if this is true, then it needs to return the value of the LAST column of the matched row in Sheet B.

So, if Sheet A R1 A-C is 1,2,3. Sheet A R1 D needs to search Sheet B for 1,2,3. and when it finds it, (for example on row 9) return the value of the last column of Sheet B row 9. The issue is, the last value could be in column R or S or AA, there is just no way of knowing.

View 9 Replies View Related

Select Last Number In A Row That Contains Number Greater Than Zero And Return A Value

Feb 14, 2014

[Code] ......

How to create a formula in cell M2 that looks at the second row of numbers (0 and 500s) and tells me the rightmost value that is greater than zero. In this example it would return 12.

Second Question: Is there a way to return any counted value, for example the second-to-last number that is over 0?

View 2 Replies View Related

Insert Number In Cell To Return A Set Number

May 2, 2007

I need this for a tracking sheet of scores. For example, 1 gets 100 points, 2 gets 90 points, 3 gets 80 points, etc. I need to set it up for 10 places. I have no idea and have fiddled with it for two hours now. I need to be able to put a 1 in the cell and 100 appears after I hit enter, etc.

View 5 Replies View Related

Adding A Number To Deg Min.dec

Oct 24, 2008

I have a column of Latitudes (12° 32.467'S) to which I wish to add 0.09'.
The result being 12° 32.557'S

View 12 Replies View Related

Adding Number...

Dec 8, 2008

I have excel sheet with lot of number, I want total 7 digits in call. Some of numbers i have in 6 digits so I need to include 0 after “L” and Some of numbers is already has 7 digits.



Need to add “0” after “L”

View 4 Replies View Related

Return Cell Data From List When Variable Input In Second Worksheet

Nov 25, 2013

I want to return the data from a list in a cell on worksheet1 if I input a variable on worksheet2. I need to avoid VBA and pivot tables.

Example, if I put "Expense" in the input cell on worksheet2, I want to return a list of each row that has "Expense" in it on worksheet1:

Worksheet 1 (ColumnA/ColumnB):


Worksheet 2 required output (no row gaps or spaces):

Input cell "Expense" - in A1

List required (A3:B5):


View 9 Replies View Related

Adding A Transaction Number

Oct 24, 2009

I have a form that requests random info. All this information is saved to a worksheet. I would like to give each transaction a reference number. In order to do so I would like each time a new record is saved to add 1 to the previous reference number. Also I would like to start the transaction with a unique identifier "ie. rn1001".

View 4 Replies View Related

Adding Groups Of Number?

Apr 12, 2012

I have two groups of data? I selected the cells in yellow and defined the name of those cells as group1. I want to be to do absolute value of individual cells and add them up. I tried pressing shift control and enter and it still isn't giving me a number. I can do it if the numbers are next to each other but if they are separated by a row it won't let me.


View 5 Replies View Related

Adding Percentage To A Number

Oct 16, 2012

Is there a way to add a percentage to a number, I know the Method of Multiply by 1.25 for 25% The problem is there another way to formulate without the "1."

Sheet1  LMN

View 2 Replies View Related

Adding Plus 1 To Number With Letter In It?

Sep 7, 2013

I'm trying to add plus 1 to a cell from another cell but it doesn't work because the number starts with a letter. I do want to keep the letter in there for a reason so removing the letter to make it work is not what I want.


ThisWorkbook.Sheets("Invoice").Range("H5").Value = ActiveCell.Value + 1

Is it that I need to declare and set the ActiveCell value as a string or something?

View 2 Replies View Related

Adding Zero At The Start Of Number

Jan 12, 2008

I have phone numbers imported from outlook in csv format. Now these numbers are like 2782512512, i want to add Zero at the start of this number. So, it will become 02782512512. How can i do this. Find and Replace method doesn't work.

View 9 Replies View Related

Adding A 0 To The Front Of A Number

Sep 8, 2008

I have a worksheet to keep track of products. I use an SKU column with a Unique Number to keep track of those items on the shelves.

When I started my project I never imagined that my database would grow as large as it has. I started my SKU numbers with 80000, never suspecting that I would get to 90000. I am now at 125700. Many items have been removed / sold so it only encompases only 15500 rows.

On the site that I sell these Items, the SKU's when displayed start with 100000 and go to 125700 where 80000 is next and goes to 99999? ( or the reverse depending on which tab I choose ) Not sure why this is but there is nothing I can do to change the way they do it so I must find a way to change my system. With all the 80000 - 99999 items numbered - changing them to 6 digit 125700+ numbers would be a huge undertaking so I would like to add a 0 in front of each 5 digit Number in my SKU Column. That way my items will show 080000- 125700 instead of starting in the middle.

I do keep the column my ascending order so it is currently formated as a Number. I do at times copy an paste or pull ranges items by SKU numbers to mark down or modify.

When I place a 0 manually in front of 80000- it disappears when I move from the Cell.

If I change it to a TEXT cell- it stays in place.

Excel help doesnt answer my dilemma-- nor does my book.

I see there are masks etc -- or is just text OK ? (as I stated - I do use an numbered order or range to identify groups of items at times )- if text is OK, what is the best way to add a 0 to the start of each 5 digit number other than individually ?

There are Gaps in my sequence so I cannot just replace the first cell with 080000 and pull down.

View 9 Replies View Related

Copyrights 2005-15, All rights reserved