Subtracting Two Arrays Of Data And Putting The Result In Some Cells
Dec 11, 2009
I was trying to subtract two arrays of data and putting the result in some cells but with no success unfortunately. I'm relatively new to VBA and I'm just starting now to make calculations with arrays so excuse my little knowledge. The arrays that I'm trying to subtract are from row 1 to 250 and m and n variables have the number of the columns. Here is my routine:
View 3 Replies
ADVERTISEMENT
Jan 18, 2009
If I have the following: =SUM(E2:F2) - G2). So lets say that E2 has 50, F2 has 60 which = 110. Now I want to take that 110 and subtract it from what is in G2 and put the result in H2.
View 2 Replies
View Related
Oct 10, 2011
I have a sheet with 2 colomns: client number and document number, as follows:
Client number Document number
1234 100012
1234 100042
4321 102233
4321 249123
4321 533213
4567 134123
7890 123451
7890 125675
7890 357353
I need to have a unique client numnber on 1 row with all his documents in one cell, as follows:
client number: document number
1234 100012, 100042
4321 102233, 249123, 533213
4567 134123
7890 123451, 125675, 357353
View 5 Replies
View Related
Aug 18, 2009
I need to take data from a cell that has a space "cherry banana", and make it into two cells "cherry" and "banana". I want to duplicate my line on which the data resides, if possible.
What I have is a sheet like this:
View 5 Replies
View Related
Mar 26, 2014
I have a cell in A1=(str identification is = ",) and in B1=(2). In C1 I want it to equal (str identification is = ",02) In C1 I have A1&B1
View 4 Replies
View Related
May 31, 2012
In column A of my worksheet I have values starting from A4 as below:
A4-1000
A5-1000
A6-1000
A7-2000
A8-2000
A9-1500
A10-2200
A11-2200
A12-2200
A13-2200
and so on till A10200.
What is want is to put thick box borders for similar values using a macro. For e.g. i want to put the borders to first 3 cells together as these are of same value 1000, then it has to be put to A7 & A8 (Value - 2000), then for A9 alone, then for A10 to A13 together till i have values in column A.
View 5 Replies
View Related
Feb 5, 2014
I have a total number of hours I want to subtract from. Example in cell e3 I will have 800 hours. In cell f3 I have the number 2 (to represent 2 workers at 40 hours, so that should total 80). I then want f3 to multiply by 40, then that total subtract from the 800 hours in cell e3. Basically I want to be able to put 2 workers in a cell, have that multiply by 40 and minus from the 800 hours in cell e3. I want that to carry on for cell g3, etc.
View 1 Replies
View Related
May 8, 2013
I am retrieving a CSV file from the net. In this file there are 'x' amount of row data and 7 columns. I only care about the values in the 7th column for each row. I also don't care about the entire first row. A graphical version would be represented something like this, with the values I want colored in orange:
|---,---,---,---,---,---,---|
|---,---,---,---,---,---,---|
|---,---,---,---,---,---,---|
|---,---,---,---,---,---,---|
|---,---,---,---,---,---,---|
|---,---,---,---,---,---,---|
|---,---,---,---,---,---,---|
.
. extending until the end of the data set
.
I've managed to dice this thing into a jagged array by first splitting it using vbLf as a delimiter, and therefore adding those to an array called Lines(). Then I split Lines() up using commas as the delimiter and threw those into a jagged array, let's call it Breadcrumbs()(). I want to throw all the values from Breadcrumbs(i)(6) into an array of its own. Here's my code so far:
Code:
Public Sub CSVparser(file As String)
Dim Lines As Variant
Dim j As Integer
Lines = Split(file, vbLf)
ReDim breadCrumbs(UBound(Lines)) As Variant
For i = 1 to UBound(Lines) - 1
breadCrumbs(i) = Split(Lines(i), ",")
Next i
End Sub
View 1 Replies
View Related
Nov 3, 2008
I am trying to Put a border around cells that arent empty. Is this possible?
View 11 Replies
View Related
Jan 10, 2014
Solve the following error: Run-time error '1004': Method 'Evaluation' of object '_Global' failed
My VBA code:
Sub Difference()
For i = 1 To 23
Sheets("Sheet" & i).Select
[Code].....
View 9 Replies
View Related
May 15, 2014
Say I have the number 325 in A1. Each time I type a number in A2, B2, C2, D2, E2, A3, B3, etc... I would like the number (325) in A1 to be reduced.
Also, how do I create a pull down list?
View 6 Replies
View Related
Jul 18, 2013
i am trying to Put a specific value i,e "NO Deliveries" in blank Cells in the same row based on value in 1st cell of the Row which has a fixed value . note:the columns and rows are dynamic for example: I want to put the value "no Deliveries" in cell C because its blank.
A B C D
% of Availability
0.00%
80.00%
View 9 Replies
View Related
Mar 25, 2009
I have attached the file with this post.
What I like a macro to do is:
Whenever a 'D' ends in column "Step 5" the last value of 4 cells to the left to be put in sheet 2 in reverse order.
View 5 Replies
View Related
Oct 19, 2012
I have a spreadsheet of clients' body weights each week which goes in a column and to the right of it I have a "diff" which I want to show weight gain/loss.
So for a client with weigh-ins the week of 10/1, 10/8, and 10/15 the columns will be:
10/1(V1)--Diff(W1)--10/8(X1)--Diff(Y1)--10/15(Z1)...and so on.
If I have weigh-ins for each week, no problem. I would just have to: =SUM(X1-V1) to get the change in weight from the week of 10/1 to 10/8. Say the client weighed 200 on 10/1 (V2) and 195 on 10/8 (X2), the difference (or "diff" (Y2)) would be -5.
But let's say the client didn't weigh-in on 10/1. The difference in weight is going to be 195. Or if they weighed-in on 10/1 but didn't on 10/8 it's going to read -200.
So I have two cells (say V2 & X2) that if one of them is blank, I want the "diff" to read "N/A" or at least leave the cell blank.
View 2 Replies
View Related
Dec 10, 2013
Here is what I have:
A B C D
Date ReceivedApproved DateDenied DateTurn Time
1/1/14 1/13/14 9
Turntime is calculated with this formula:
=IF(A4<>"",IF(COUNT(B3,C3),NETWORKDAYS(A3,IF(B3<>"",B3,C3)),""),"")
What I need is to not count the first day it is received in the calculation for the Turn Time. So in this instance I need the Turn Time to say 8 instead of 9. If I just subtract a 1 then I get an error if the Approved Date or the Denied Date are not filled in yet.
View 4 Replies
View Related
Mar 11, 2011
I had a question considering a workbook that I am working on for overtime, a different one than I posted before. On my workbook, I have vacation leave, sick leave, and overtime to figure in. I want to be able to have a choice to choose which you would like to keep at the end of the week. Such as if you were to work 8 on Mon, 8 hours on Tues, 10 hours on Wed, and then take vacation leave on Thur, for 8 hours, and then work 6 hours on friday, I need a way to choose whether to be paid for the overtime and vacation time, or to subtract two hours from my overtime and add it to my regular time, i.e. 40 hours, or subtract two hours from my leave time and add it to my regular time. I know this sounds complicated, it is at least to me.
View 3 Replies
View Related
Apr 1, 2014
There are two sheets with data:
Sheet 1
Column A - reservation number (unique)
Column B - trade partner
Sheet 2
Column A - reservation number (unique)
Column B - Hotel property
I want to put in one sheet: Reservation number - trade partner - hotel property
In another words I want to have a list of all reservations according to hotels and partners.
View 2 Replies
View Related
Dec 23, 2013
I am having trouble being able to put data into a table. The data I have breaks down orders of products in crates into lots of 45 crates with a remainder.
I would like to be able to fill a table from left to right which displays the item number with the corresponding amount of crates, which seamlessly goes from one item to the next.
I have attached an example.
pallet data.xlsx‎
View 5 Replies
View Related
Mar 7, 2012
I have a question about putting data in the right order. I have this order in my excel files:
City A, City B, City C
10 20 20
20 40 50
15 30 40
45 20 10
50 10 10
20 30 40
I need to put them in order from top to bottom like this:
10
20
15
45
50
20
20
40
30
20
10
30
20
50
40
10
10
40
Is there any way to do this in a fast way. Because I have 440 cities and 13 numbers per city copying and pasting will take a long time..
View 1 Replies
View Related
Jun 1, 2008
I place the below formulas in A1,A2,A3 …A100
A1 = --(D10:D20="A")
A2 = --(E10:E20="F")
……….
These formulas return arrays {1,0,01….) and of course they can not be displayed in single cells (error message).
Is there a way I can use them in a sumproduct formula?
C1 = SUMPRODUCT(A1*A2*A3…*A100)
The reason is that in reality they are much more complicated and I get error messages (length of the sumproduct formula) and secondly this way I can “understand” and use better my formula.
I dont think that i can "break" the sumproduct in smaller pieces and would be great if i can do something like the above.
View 9 Replies
View Related
Apr 14, 2013
I'm trying to set up a relatively simple UserForm, which will collect the name of a project from a ListBox, a project update which will simply be text entered into a TextBox, and a estimated completion percentage (factor of 10, 10/20/30% and so on) which will come from another ListBox.
I've managed to get many of the basics working, for example an OK button and a CANCEL button, but there are a few bits that I'm still finding rather tricky.
I have the selected date in the percentage listbox going back into my chosen place in the spreadsheet quite happily, but I can't get it to work for the project name listbox (I think it's because the options come from rowsource and weren't entered manually like the other one). I'll paste my code at the end so you can all see how I've done it (and have a laugh)!
I have also just about managed to get the data to go to the right place in the spreadsheet. I want the data to appear in columns, column 1 for the project name, project update in 2 and percentage complete in 3. I have this working, but it for any reason one cell becomes blank, my code uses that cell, and that could cause entries to become mixed up. I want the UserForm to enter data on the first entirely empty row.
Here's my code:
VB:
Private Sub Cancel_Click()
Unload ProjectUpdate
End Sub
Private Sub Clear_Click()
Call UserForm_Initialize
End Sub
[Code] .....
View 7 Replies
View Related
Jun 26, 2008
I am trying to subtract 12 business hours from a date/time stamp. It has to be during working hours however which are 8AM - 5PM, Monday-Friday.
For example if my value is 6/23/2008 9AM
Subtracting 12 business hours would give me 6/19/2008 3PM.
View 9 Replies
View Related
Aug 6, 2014
I'm looking to look up sheet name based on a date, then look the date up within that sheet which is a merged cell, then return the figure in the corresponding cell.
I have a sample worksheet to attach, just have to work out how to do it.!
In the sheet "Cashflow Summary" in cell E24, i want to lookup the sheet name based on the value in C22 (merged cell), then lookup the date in that sheet (6 August 2014), and return the value in cell y8.
The difficulty is with firstly the merged cells, but also performing the lookup over a number of different arrays, as the sheets for each month, have the months listed under each other in rows of 5 days at a time.
View 3 Replies
View Related
Jan 14, 2009
Though I am familiar with the use of Array in formulas I can't seem to get my head around the way arrays are used in the VB world.
It is my understanding that you can read and write data into an array for copying/moving it around and reordering.
This is a simplified version of what I am trying to do.
I have some data in a row, say:
1, 2, 3, 4, 5, 6, 7, 8 etc.
I would like to poplute an array and then "Write" the data into a range so that it comes out something like:
2, 4, 1, 3, 8, 6, 7, 5 etc
I have tried to play around with array in Vb but could not seem to get anywhere.
Am I mistaken that is is possiable?
If someone could point me in the wite direction I would appricate it.
I have searched for this online and have found examples that I either did not understand or was unable to adapt...
View 9 Replies
View Related
Dec 12, 2008
I am looking for code to do the following:
1. Copy data from Column A in Sheet1 (could be up to 1000 rows)
2. Paste the data in Sheet2 in "arrays" of 9 columns and 16 rows
So basically, the first table would contin the first 16x9 = 144 numbers that are being copied and pasted from Sheet1. The second table would include numbers 145 to 288 and so on.
View 12 Replies
View Related
Sep 19, 2008
I an newbie at VBA but I took some short programing classes back at my college days. I am trying to declare an array with different data types and since that seems to be imposible for what I gather then my other option is to declare what I remember as a structure.
View 9 Replies
View Related
Jun 1, 2007
I have formed data arrays in VBA after running a time series simulation model. The array is m simulations x n periods. Small example: ...
View 6 Replies
View Related
Aug 25, 2014
Any easy way to retrieve data from another table using an array formula.
I have two files that I am using that contain 2 sets of data with columns for name, address, city, and state. The red highlighted data needs be used to find the blue data first column, which is a possible name for the company found from the red data. The issue is that the blue data is larger and has rows of data that will not be found in the other table.
I have the spreadsheet attached. I attempted to use an if/and statement :
=IF(AND(D2=C8I:I,E2=J:J),H2,0)
but found out that it does not work with arrays and only found the first address by default.
How would I set up a formula to retrieve the possible names using criteria from the blue data such as if the address and city match, then input that company name?
View 5 Replies
View Related
Nov 20, 2008
I would like to select a item from a list and have a text box display data from the next column (corresponding row) Also, I would love if I could type something into a second textbox and have that copy onto a third column (again, corresponding row) Also, if the add comment command button could transfer that record to the "commentted items' sheet. I have attached an example.
View 2 Replies
View Related
Jun 20, 2012
I have code that runs through multiple arrays trying to match data to items in the arrays and it takes a long time to run.
Code:
dim a as long
dim b as long
dim c as long
dim d as long
dim e as long
dim MyAarray as variant
[Code] ..........
That's basically what the code does. however, it takes an extremely long time to get through with everything as each array increases in size.
View 7 Replies
View Related