# Compare Column Number Of Cell With Last Cell Column Number In Loop

Jan 11, 2014
I am trying to save an excel sheet to .csv format with the following macro:

[Code] ......

The following part of the code needs to be modified so that the commas appear correctly in .csv file even for null values for any given column.

[Code] .....

I have attached the Sample Sheets. Source sheet and the Result sheet. The Result sheet doesn't provide the required result. Some data are missing and unwanted commas have been added. How to correct the logic in the above piece of code.

Attached File :

Result Sheet.csvâ€Ž

Source.xlsmâ€Ž

View 14 Replies
ADVERTISEMENT
Jun 2, 2008

to update these values via a form in this sheet. I can find the correct row to be edited by entering a value from column A and B. The problem is if I want display the values of that row first and then change it. If I want to change row 10 data how can I bring back the value in ROW 3 AND THE COLUMN VALUE? The next step would be to do the actual update if I want to change ROW 10 to "Ooi" and a sales value of 200?

This is what I have done so far:

Dim myRows As Integer

With Sheets("Mrt")

'Retrieve history information for row

For myRows = 4 To 49

If comboxDay.Text = Range("A" & myRows).Value And textboxdescription.Text = Range("B" & myRows).Value Then

textboxbedrag.Text = Range("C" & myRows).Value

chkBTW_Ja.Value = Range("D" & myRows).Value

txtNota.Text = Range("S" & myRows).Value

End If

Next

End With

Picture attached to show how sheet looks like.

View 9 Replies
View Related
Nov 5, 2008

I was wondering, is there a function that would take, lets say, every 4th cell value from a column and create another column consisting of every 4th number ?

View 2 Replies
View Related
Jun 24, 2014

I have a spreadsheet with rows of data. I need a formula that will return the column number of the last column in a row where there is a value >0.

Let's say that cells A1:F1 contain values. Some have values of 0 while others have values >0. I need a formula in cell G1 that will tell me the column number of the last value >0.

A B C D E F

0 2 5 0 6 0

So the formula in G1 would return a value of 5, which corresponds to column E.

View 3 Replies
View Related
Jan 31, 2008

I've been searching the forums for this problem but I can't seem to find any answers. Anyway, this is the problem. See screenshot.

I want to compare A1 for the values in column B, then return the corresponding cell (column C) in column D.

e.g. D1 = 2, D2 = 1, D3 = 4, D4 = 5 and D5 = 3.

View 9 Replies
View Related
Dec 27, 2013

A column:

18

42

55

11

65

72

80

48

..

I want to put/write to B column the some numbers (42,11,72,48..) in A column.

B column:

=A2

=A4

=A6

=A8

..

How can I achieve it?

View 12 Replies
View Related
Dec 11, 2008

I have a basic formula =C17+'Asset Depreciation 2008 Onwards'!C24, and I want to copy it down just using the drag function. Problem is that the second reference range of cells are in rows and hence when I copy it down it doesn’t automatically update the cell references because it want to update them by column number instead of row number. IE I want it to display =C17+'Asset Depreciation 2008 Onwards'!

D24, instead of C25. Do you know if there is any way of telling Excel that I want it to increase the column number by 1 every time, instead of the row number for this part of the formula?

View 5 Replies
View Related
Apr 16, 2014

How can I compare the data of two columns, and if the same, to show me the number from a third column? I upload a quick sample

View 4 Replies
View Related
May 23, 2014

file storage

1. Look at the "Days so far" section

2. Ignore cell C1

3. All the other cells in that row are shaded blue. Look at these.

4. Look at the "Volunteer" row - all the cells in that row are shaded blue. Look at these.

5. Wherever a name - any name - appears in the "Volunteer" row, 1 is added to the previous number in the "Days so far" section and the result is displayed in cell from the "Days so far" row above that Volunteer's name.

6. For example, we begin in C1 with a count of 12 days so far - this was manually entered

7. In cell H5, we see Henry has volunteered 1 day. The total no. of days so far should now be 12+1. Therefore, the number in H1 should be 13.

8. In cell G47, we see Joseph has volunteered 1 day. The total number of days volunteered BEFORE Joseph volunteered is 15 (see cell D43). But now, with Joseph volunteering 1 day, the total no. of days so far should now be 15+1. Therefore, the number in G43 should be 16.

9. what formula l must put in the "Days so far" row (excluding cell C1, which is manually input) to give me the "should be" results predicted in that row? I'm guessing it will be a formula which looks at each row fragment of the "Days so far" row, row by row, right up to the previous cell in that row, all within one formula.

P.S. I just want to leave the "Days so far" row blank, for any columns where there are no volunteers in the "Volunteer" row, so please don't give a formula which inserts zero for days with no volunteer, and then sums the cumulative total.

View 5 Replies
View Related
Dec 18, 2013

I'm trying to look at each cell in column A and ask In C2 "If A2 contains a number that is listed in D2:D5, then 1, else 0". I've attached a sample. I am not sure this is even possible via formula, I would take VBA if needed.

View 4 Replies
View Related
Oct 19, 2012

If we don't use offset() function, we can probably use the following approach to fetch the cell value using its row number and column number:

INDIRECT(ADDRESS(A1,A2))

Here, suppose A1 and A2 store the row number and column number respectively.

But the one here only applies to the same sheet. What if i want to get value from a different sheet? For example, two sheets: Sheet 1 and Sheet 2.

If I type the formula in Sheet 2:

=INDIRECT(Sheet1!ADDRESS(A1,A2))

Then this results in an error.

View 3 Replies
View Related
Jun 28, 2014

I am trying to find the column number of the 3rd (or nth) occurrence of text in a cell in a 1 row table using a formula. The table looks like it contains date and value entries, but they are actually all formatted as text.

View 13 Replies
View Related
Feb 13, 2010

I need to get an average percentage for the column in the sample. I dont know how to do it with the error cells and the empty cells. I need an average for only the cells with a number in them.

View 2 Replies
View Related
Dec 18, 2007

I have a Range variable that points to a particular cell. If I wanted the address, I would do, cellName.Address. This returns, for example, "$F$3". If I wanted to have the column "F" as a number (column F would be the 6th column, so 6), how could I do that without storing some kind of array of letters and number equivilants. It would also have to work past the 26th column when the column addresses switch to, like, "AA", "AB" etc.

View 3 Replies
View Related
Jan 23, 2008

MATCH(3, A:A, 0) will return the row number with the first number '3' in column A. I need to search for the first empty cell in column A.

View 2 Replies
View Related
Jul 31, 2014

I have one collum with number ranging from 0-1000 in. I have another collum titled "above 90".

How do I get the "above 90" collum to display as 1 if the number in the other collum is above 90?

I understand it must be some kind of "COUNTIF" function but not sure...

View 7 Replies
View Related
Jul 16, 2014

I am looking to write a formula that will return the row or column number of the cell that contains a particular text within the string. I know it can be done with script, but need it as a formula. Also, to add another level of difficulty, I'd like it to be a traditional formula, no special keystroke to activate. It will be used within a much larger formula.Ex. If G5 has the string "CURRENT DATE" in it, and I look for "DATE", the formula would return 7 for the column or 5 for the row.

View 4 Replies
View Related
Aug 13, 2009

I have a name in cell A1 and a number of 20 in cell B1. Is there a function to copy the name in cell A1 the number in cell B1 (20 in this case) times into column C?

View 9 Replies
View Related
Feb 6, 2014

I have a formula in Cell A1. It tells me the cell location of the last number in column E. So, for example, I input the number 44 in cell e85, the value for cell A1 becomes $E$85.

Let's say I now put the value 33 in cell e86, now the value for A1 becomes $E$86.

I want to calculate the average of the values in column E, all the way from E1 to whatever is in A1.

Here's what I need: =AVERAGE(E1:<whatever is in A1, like $E$85>)

How do I write the AVERAGE formula to make this work?

View 6 Replies
View Related
Jul 13, 2014

a1=aaa

a2=111

a3=222

a4=333

a5=bbb

a6=444

a7=555

a8=ccc

a9=909

a10=234

if a1 = aaa then copy a1 to b1 until the cell =bbb

if a5= bbb then copy a5 to c1 until the cell =ccc

if a8= ccc then copy a8 to d1 until the cell = ddd.........

View 1 Replies
View Related
Apr 11, 2014

I have attached a sheet as an example, as i am trying to Divide a cell by the number of populated cells in that column e.g column (A) has a table of 16 but only has 13 populated cells in that column, the sum would be something like this =sum(A18/13. Sometimes the column will have less and at times more populated.

test sum skip blank cells.xlsxâ€Ž

View 2 Replies
View Related
Aug 15, 2012

code that will count the number of cells under a "title cell" that is recurring in a column, and then divide the result by 2. The result will then be displayed in another column preferably aligned to the "title cell" (in this case "Items") in column A.

For example:

Before code is applied

A1: Items

A2: Items

A3: four-legged

A4: dog

A5: two-legged

A6: chicken

A7: Items

A8: four-legged

A9: cat

[code]....

After code is applied to column A

A1: Items B1: 0

A2: Items B2: 2

A3: four-legged

A4: dog

A5: two-legged

A6: chicken

A7: Items B7: 1

A8: four-legged

A9: cat

[code]....

View 9 Replies
View Related
Feb 13, 2013

I want to count the number of rows in a specific column up to an empty cell and assign this value to a cell. I don't want to count the total number of rows but instead I want the number of the first group of rows.

For example, column A may have cells ranging from row 2 to 10 and then from row 12 to 20, so I only want to count the first group.

The below code counts the total which is not what i need.

Code:

Sub test()

Dim Mycount As Single

Mycount = Application.Count(Range("A:A"))

Cells(1, 4) = Mycount

End Sub

View 2 Replies
View Related
Oct 14, 2013

I am trying to find the last cell with data in a spreadsheet once this has been found select all up upto cell A4 and then format these cells into number format to zero decimal places so far I have the following which finds the last cell:

LR = Cells(Rows.Count, "A").End(xlUp).Row

Range(Cells(LR, 1), Cells(LR, "A")).Select

View 1 Replies
View Related
May 22, 2014

I am trying to read a value in cell A1 and make say cell B1 read the same. The data in cell A1 is a real time percentage value that gets updated every lets say 10 secs. Every time the data is updated the new value goes into the next cell A2, A3, A4..... and so on. Every time it gets updated (i.e into A1,A2,A3,A4.....and so on), I want to read the new value each time in B1.

View 9 Replies
View Related
Jul 25, 2014

I am creating a spreadsheet for my job and knew a code or any way to implement this into my spreadsheet.

View 1 Replies
View Related
Dec 30, 2009

i want to fill down a column and instead of my formula changing from A6 to A7 i want it to change to B6.

View 9 Replies
View Related
Jul 29, 2013

I have been trying to format the rows on this sheet to color scale red based on the number of repeat text strings in Column E. Referring to the attached example sheet, '321/312.2/321.3' appears the most times and the goal is to color code the rows it appears in the deepest shade of red, then the next highest occurring string would shade the rows it appears in a lighter shade, etc, in descending order. Our team currently does this across multiple sheets manually everyday and it would be a real time saver if we could get excel to do this automatically.

View 14 Replies
View Related
Jul 21, 2007

I am building a Workbook which takes data from SheetA and inserts it into SheetB.

Part of the data is only entered when a positive value exists.

I then do an export from SheetB.

The problem is that I need to get the column number and pass it to the cell reference based on the field name in row 1.

Dim sFindstring As String

Dim rFindcell As range

Dim iR As Integer

Dim iC As Integer

sFindString = " Find this string in the cell"

'Using cells find the findstring

Set rFindCell = Cells.Find(What:=sFindString, After:=[A1], LookIn:=xlValues, LookAt:=xlPart, SearchOrder:=xlByRows, SearchDirection:=xlPrevious)

'OK so look here

iR = 3

'I am trying to pick up the column number

iC = rFindCell.Column

rFindCell throws an object or with block variable not set error. Is there some property that I need to set.

View 3 Replies
View Related
Jan 13, 2009

I want to compare a cell with a number of other cells to check if their value is the same. If it is the same an IF function will perform some action.

For example I want to check if A23 is equal to B23,B24,B25.....B50

Something like IF (A23= B23 to B50,"hi","bye")

The problem is that I dont know how to write "B23 to B50" in a format Excel will understand.

View 12 Replies
View Related