Hi, I am totally new to Excel VBA. Firstly, I want to copy the data when the condition is met(copy data with reference to 144)
Secondly, compare the cells, if it is IT Operations(Table1) to IT Operations(Table2) then copy the price(money) to column F. If the variable is no there then leave blank.
This can be done with formulas. Here is one way of thinking about filling column F, with the prices for the matching items in column E, by matching the number given in the last row in E (144 Total); which i shall assume is E10 in this case.
Total formula in F1 which you then drag down is:
=IFERROR(IFERROR(VLOOKUP(E1,INDIRECT(CELL("address",OFFSET($H$1,MATCH(1*LEFT($E$10,FIND(" ",TRIM($E$10),1)-1),$G:$G,0)-1,,1,1))&":"&CELL("address",OFFSET($I$1,MATCH($E$10,$G:$G,0)-1,,1,1))),2,FALSE),VLOOKUP(E1,G:I,3,FALSE)),"")
In steps:
Extract the number of interest e.g. 144, and get rid of any trailing/leading whitespace using:
LEFT($E$10,FIND(" ",TRIM($E$10),1)-1)
Find which row this value is in as this will be the first row of the lookup range for this number. *1 converts text to a number.
MATCH(1*LEFT($E$10,FIND(" ",TRIM($E$10),1)-1),$G:$G,0)
This gives row 9.
We can use something simpler to find the last row of the range, which holds 144 Total
MATCH($E$10,$G:$G,0)
This gives row 15. So we know the data lies between rows 9 and 15 for 144.
We can turn this into a range to use in a VLOOKUP with INDIRECT and OFFSET.
=CELL("address",OFFSET($G$1,MATCH(1*LEFT($E$10,FIND(" ",TRIM($E$10),1)-1),$G:$G,0)-1,,1,1))&":"&CELL("address",OFFSET($H$1,MATCH($E$10,$G:$G,0)-1,,1,1))
This gives us $G$9:$H$15. Note adjustments of -1, to put OFFSET back in the right row, and that the OFFSET start cells are in different columns to provide the columns required for the VLOOKUP.
So we can now lookup column E values e.g. Enhancement, in our newly defined range which is accessed via INDIRECT:
=VLOOKUP(E1,INDIRECT(CELL("address",OFFSET($H$1,MATCH(1*LEFT($E$10,FIND(" ",TRIM($E$10),1)-1),$G:$G,0)-1,,1,1))&":"&CELL("address",OFFSET($I$1,MATCH($E$10,$G:$G,0)-1,,1,1))),2,FALSE)
This is saying VLOOKUP(E1,$G$9:$H$15,2,FALSE) i.e. get the price column from the range for the item specified in E1.
If this is not found i.e. returns #N/A, we can use this to first check if this is because of the merged cell that holds the 144 Total; where the value is actually in column G not H, and use an IFERROR to say, if not found in $G$9:$H$15 then try for a match using columns G:I and return column 3.
Which with pseudo formula, using priorLookup as placeholder, for the formula described in the steps above, looks like:
IFERROR(priorLookup, VLOOKUP(E1,G:I,3,FALSE))
If this still returns #N/A, we know the value is not present and we should return "". This we can handle this with another IFERROR:
IFERROR(IFERROR(priorLookup, VLOOKUP(E1,G:I,3,FALSE)),"")
So giving us the entire formula stated at the start.
Here it is used in the sheet:
I have a row of 4 cells that contain either 3 0's and a number, or two numbers and 2 0's. I need excel to check the cells from left to right and if a cell contains a 0 move on to the next cell until it finds a number and then return that number in cell 5. Any help would be grately appreciated!!
My test Data
enter image description here
Enter this formula in Column E,
=IF(A1=0,IF(B1=0,IF(C1=0,IF(D1=0,"All are Zeroes",D1),C1),B1),A1)
Use this formula:
=INDEX($A1:$D1,AGGREGATE(15,6,COLUMN($A1:$D1)/($A1:$D1<>0),1))
I can't find anywhere a function that would allow me to count every cell in a column except a certain value given.
For example there is a column where the values are (-), 1, 2 and 3 , I want to count all the cells that are not "(-)".
So there should be a function like
=countif(A1:A100, Not "(-)")
Does anyone how to do that?
This can be done using <> for not equal, like so:
=COUNTIF(A1:A100, "<>-")
Replace the - with what you want to not count, and change A1:A100 to the range of data you would like the formula to consider.
I have a row that only one cell within that row will contain a number value (which could be any number).
On another sheet I need a formula which will find if the number from the row and return me that number value?
Something like that would give you the first number found in column A.
=INDEX(A:A,MATCH(TRUE,INDEX(ISNUMBER(A:A),0),0))
It scans the column until it finds a number and writes it down in the cell.
When the range of cells contain blank cell, the sum function always give a 0,
column
2
3
blank
blank
4
=sum(A2:A6)
I expected the SUM give 9, but it is zero. The formula =SUMIF(A2:A6,"<>") not work, may be it work for excel, but not in Numbers
Turn Blank into "0" instead of leaving it blank.
Use IsNull(Column, 0)