Check Values Of Cells & Return Value Accordingly
Sep 12, 2007I am tryng to perform a logical statement using 3 fields, ex
A1>0,B1<0,C1<0 returns
A1>0,B1>0,C1<0 returns
A1>0,B1>0,C1>0 returns
end statement
I am tryng to perform a logical statement using 3 fields, ex
A1>0,B1<0,C1<0 returns
A1>0,B1>0,C1<0 returns
A1>0,B1>0,C1>0 returns
end statement
Let's say i got something like this
A B C D Result
200 250 Apple 600 Melon
251 450 Orange 225 Apple
451 700 Melon 325 Orange
751 900 Grape 457 Melon
So based on my example above, I have those data from column A to column D Now, how do I check if the value from column D belong to which category from column C based on the column A and B?
225 -> 200~250 -> Apple
325 -> 251~450 -> Orange
etc.
The result will appear on "Result" Column
I'm quite new in VBA and it can become a painful process to complete a working code. What I'm working on is a small process which looks up in individual cells within a range (ccy), for a particular value (EUR or USD) and if it finds that value, another cell in the same row with the value found is entered a certain text. What I wrote is:
Dim ccy As Range
Dim zone As Range
Dim i As Integer ...
Allows me to check like 10 different text values and return false for all of those in the conditional formatting rule. When those are not present, the conditional format is true thus applying the format.
I tried
=NOT(FIND("text1",$A$1,1))
It did not work because I believe this statement doesnt give the rule its TRUE value its looking for.
I am having trouble with this, to clarify I need the below...
Cell has conditional formatting checking for text1 text2 text3...text 10ish and if they are present nothing will happen and if they arent present then format the cell.
EDIT: to clarify, the code should look for either text1 or text2 or text3 so on...
I want to divide the numbers from 2 cells, down a long column. Let's further say that in some instances there aren't any numbers in either of the cells. You get a divide by zero error.
So you have values in a1 and b1 through a10 and b10. You want to divide the value in the a column by the value in the b column and return the answer in the adjacent c column. You've copied the formula all the way down to c20.
All the cells from c11 to c20 will have divide by zero errors.
What is the syntax to check if both cells in columns a and b are greater than zero so that either an answer will be returned or just a blank cell will result, (when nothing is in one of the cells from a or b?
The following formula works for checking the status of cell A, how do I also check the value in cell B?
=(IF(A5>0,A5/B5,""))
something like?:
=(IF(A5>0 and B5>0,A5/B5,""))
I have cells that they're values should be equal B6=B11, B7=B12, B8=B13, E6=B14, E7=B15, E8=B16, I want a macro that if the values are not equal then the background should be RED and a pop up message "The values should be equal".
View 9 Replies View RelatedI am looking for a macro that will check 2 things....then do something.
The first is if a range of cell values in are blank. lets say
Sheets("Sheet1").Range("D6:G48").
Next is if a particular cell contains a given value ,
Sheets("sheet1").Range("E5") should equal "Year 1" if true.
If both these are true then I want the macro to copy a range of cells from
Sheets("Sheet2").Range("H6:H48") to Sheets("Sheet1").Range("D6:D48").
I tried to use IsEmpty but it seems to return a "False" if a range of cells
are being tested.
In Worksheet 1, Cell B63 I would like to create a drop down menu, with two options for the user to select - 0.05 and 0.01. I would like each selection to then control the formula in the cells C63:L63, for example;
Where 0.05 selected it computes for cell C63:
=IF( COUNTA(C4:C54)=0,"",IF('WORKSHEET4'!N55>'WORKSHEET4'!L55,"YES","NO")
then cell D63
=IF(COUNTA(C4:C54)=0,"",IF('WORKSHEET4'!AC55>'WORKSHEET4'!AA55,"YES","NO")
and so on
Then if 0.01 selected it would compute for Cell C63
=IF(COUNTA(C4:C54)=0,"",IF('WORKSHEET4'!N55>'WORKSHEET4'!K55,"YES","NO")
then cell D63
=IF(COUNTA(C4:C54)=0,"",IF('WORKSHEET4'!AC55>'WORKSHEET4'!Z55,"YES","NO")
I have two worksheets. One contains my master data and the other my look up table.
Master Data: ....
I'll quote the example straight away.
Col A Col B
A,S,F A,S
A,R,S A,R,S,T and so on.
There is no fixed pattern for the values, but they are separated by commas only. All i need is to compare col A and col B and return me the value in Col C like this,
Col C (col C is to know the removed value from comparison)
F (for line 1)
Col D (to find the letters that are added from comparison)
T (for line 2)
Here's a simplified example:
ColA
ColB
ColC
Row1
A
Y
A
Row2
B
N
D
[Code] .........
I'm looking to return the values in column A adjacent to the cells in Column B equal to "Y". The kicker has been returning only the cells where the condition is true. Column C displays the desired behavior.
The closest I've been able to get is with a simple IF statement but I'm pretty sure the answer is a far cry away from there and likely requires an array formula. I'd prefer not to use VLOOKUP or OFFSET but will if the alternative is very complex.
I am trying to learn more about functions like IF(), AND() MATCH() and LOOKUP()... but so far I cant seem to get it right. I am actually trying to get a simple working formula that can take a value from the first tab and cross reference it with a table in the second tab to return another value in the first tab.
For example....
On the first tab/sheet named "Details", i have a list of people, an area of work they fall in and then a column named region that categorizes their areas of work into groups
A
B
C
1
Name
Area of Work
Region
2
Mr A
J
?
3
Mr B
6
?
4
Mr D
Z
?
5
Mr E
18
?
Then on the next tab/sheet named "Category", I have a table which lists the areas that belong to a region;
A
B
1
Region
Area
2
1
A-J. 1-6
3
2
K-P, 7-15
4
3
Q-U,W,Z,16-20
I have tried formulas like IF(AND(B2=Category.B2),"1","ERROR") but it keeps returning me "ERROR" when it should return "1"
Vlookup or Match for a product list project.
I need "my sheet" to populate (columns A,B,&C) with some source data; however, I need the lookup to reference both retailer# and color (columns D&E) and return other information such as description, color description, etc...
Here is the example of both sheets:
My Sheet:
Row/Col.
A
B
C
[Code]....
I am trying to find a way to use information in one cell in order to look up corresponding multiple values on another sheet. The problem that I am running into is that VLOOKUP only returns the first value. I need the values to be calculated in different cells going vertically, not all combined in the same cell as was in an earlier post. I am not looking to sum anything so a pivot table also doesnt work.
Sample data:
A / B / C / D
Identifier / Pub ID / Invoice # / Job #
ABCD1234 / ABCD / 1234 / A41254
ABCD1234 / ABCD / 1234 / B41254
ABCD1234 / ABCD / 1234 / C41254
DCBA4321 / DCBA / 4321 / A56789
etc.
I am looking for it to do this:
A / B
Identifier / Job #
ABCD1234 / A41254
/ B41254
ETC.
I want to enter ABCD1234 into another worksheet and have it return all of the job #'s, but I have a lot of these so I don't want to have to look up how many job numbers there are associated with it and have to enter different formulas into multiple cells. Filtering also isn't an option as there are simply too many cells to calculate.
I have a range of say B1:Z2. In row B1:Z1 I have dates in the format dd-mmm-yy. In row B2:Z2 I indicate presence of a person by "P". This is at infrequent appearance i.e. p,p,p,blank,blank,blank,p,p,p,p,p,blank,blank,p,p,blank,p,p,p, etc. I am trying to find or workout a formula that would find the most repetitive Ps in row B2:Z2 and give me the sum thereof. I.e, from the above example it should be 5. It does not have to count specifically P. Something that counts the most non-blank sequence of cells in the range should also do.
View 8 Replies View RelatedI need to do a vlookup of the values of Sheet 1 Column A (Ref) in Sheet 2 Column A (Ref).
The results will be the concatenated values of Sheet 2 Column B + C + D + E to be displayed in Sheet 1 Column B (Address).
I'm not sure how I can do this using formula.
I've attached a example.
I have a data set with the weeks of the year as my column headers and a value of 1 (from a pivot table) in a distinct row value (removed for privacy) showing whether it existed in a given week based on pre defined criteria. What i need to do is ID the first (from the left) non blank cell in each row and then return that cells column header. I then need to do the same for the last (from the left) non blank cell in each row and then return that cells column header. On the attached I've put values in column N and O to show an example of what I need to return using a formula.
View 7 Replies View RelatedIm needing to search through the attached document which is truck logs at a mine and use vba to search through the list for each of the different shovels eg SHVL1, SHVL2 & SHVL3, and when the code finds that string, to display the tonnage 2 colums back from it. Im about half way there a i think but am having trouble with strings, if it was numbers i could do it no problem
View 11 Replies View RelatedI have an IF statement that I need to look at different cells and return different values if ture or false, depending on what is selected in cell J2
Cell D2
if J2 = "FMB/FPI" then retrun the value of cell Y7
if J2 = "FPI/FPI" then N/A
if J2 = "FMB/OTHER" then return the value of cell Y7
Cell E2
if J2 = "FMB/FPI" then retrun the value of cell AC7
if J2 = "FPI/FPI" then then retrun the value of cell AC7
if J2 = "FMB/OTHER" then N/A
Cell F2
if J2 = "FMB/FPI" then N/A
if J2 = "FPI/FPI" then N/A
if J2 = "FMB/OTHER" then then retrun the value of cell AC7
Essentially, sheet b is a list of 900 people I need to mail to. Sheet a has 3000 rows of people, many of whom don't need the mailing. It has mailing addresses that we need in sheet b.
We have two worksheets, sheet a and sheet b
compare sheet b, column c (email addresses) to sheet a, column x, (email addresses).
If they match, move sheet a, columns d, e, f, g, and h to sheet b.
I have data in Row 53 that spans 7 columns, but stays in the same row. I want to design a loop to select every 7th cell in that row and check if it is empty. If not, add onto a "counter" then display the final number of occupied cells (the value of the counter) at the end. This is what I have so far, but I get all sorts of errors.
Code:
Sub Tester()
Dim WB As Workbook
Dim WS As Worksheets
Dim modCounter As Long
Dim Cell As Range
Set WB = Workbook("Transverse Series.xlsm")
Set WS = WB.Sheets(BM18)
[Code] ......
I have two excel sheets. The first sheet has a column with codes and another column with dates. There are more than one date for the same code. The second sheet has just one unique code. I would like to match the code on the second sheet with the code on the first sheet and return ALL the dates associated with that code to the second sheet - horizontally.
View 5 Replies View RelatedHi, I desperately need help with a pivot-table and can't find anyone else who's ever had this problem...I have a very large healthcare data table which for simplicity I will describe as follows. In essence the first two columns respectively are (A) location and (B) month. Let's say the third column (C) is the number of cases of the disease kidpox treated in each health centre during that month. The fourth column (D) is the total number of cases of everything treated during that month in each clinic. The fifth column (E) is the proportion of cases of this disease over all consultations for each health centre and month, and the formula in E2 is .....
View 9 Replies View RelatedI have a table that has 6 columns and 5 rows. I need to check a name (division) against the column heading, then and return a classification from the first column based on the score.
Below is an example of what I am using (I'm not sure how to post a screen shot):
DIV1 DIV2DIV3DIV4DIV5
A91.7689.4198.82100.82102.35
B111.43108.57120.00122.00124.29
C141.82138.18152.73154.73158.18
D195.00190.00210.00212.00217.50
E195.10190.10210.10212.10217.60
DivisionDIV3
Total Score 155.6
ClassificationC
Is there a good way to check two columns at the same time and return the value in the 3rd?
Example
12 0.07 8
12 0.37 10
12 0.82 12
12 1.30 15
12 3.90 22
12 8.00 28
12 15.00 35
I look for 12 in the first column with vlookup but I need to also look for a figure in the 2nd column which is greater than my figure. So say I want 12 & 6.0 I would want the formula result to be 28 because the nearest larger number in the table column 2 is 8.00.
I would like to check/search if (FileName As String) is still exists in its directory.
--Why as string: because I have a hidden kollom where the links to the files are in txt format.--
I can't write VBA But maybe I can sketch it?
I have a vlookup formula I would like to add another If statement to.
=IF(ISNA(VLOOKUP($O2,Table!$A$2:$I$72,9,0))=TRUE,"Not In Table",VLOOKUP($O2,Table!$A$2:$I$72,9,0))
This works fine, but if the field that it is returning (9 in the case above) is blank, I get a zero in the destination cell.
Can I add another check in this formula to see if the destination cell is zero, but display a blank?
I have several rows with numbers that is either 0, a balance or a text like n/a. I need a formula that return true if all are 0 or contain n/a. If there is one balance shall it be false. Any suggestion? See example:
View 6 Replies View RelatedI've tried this in formulas (if, if/and, if/vlookup, if/vlookup/and) and I've been trying to write a macro for this (which I'm thinking needs to loop).
Problem: I have a report that is broken into three categories.
Column A includes locations, Column B includes vendors. Across the top, the monthly report is broken into four classifications (trans types), which are then further subdivided by quantity and cost. (Rough estimation is provided below)
Locations
Vendor
Z53
Z50
Z51
Z52
[code]....
My data comes in sorted by location, and subtotaled by vendor and trans type. So I'll have a row of data that includes:
Location 1, Vendor A, Z51, $200, 2
Location 1, Vendor A, Z53, $150, 2
Location 1, Vendor B, Z53, $150, 1
...
What I need to do is pull the data for Z53 based on Location & Vendor. So from the data is would read Location 1 & Vendor A and then find them on the report and paste into the appropriate row (in my report Z53 qty is col E and $ is col F).
I was trying to do a macro that within a determined range (finding the first and last instance of Z53) would match location and vendor to the monthly report and paste the values of Qty and $ into the appropriate fields. Below is what I managed to mangle:
Code:
Dim Holder1 As Range
Dim Holder2 As Range
Dim Holder3 As Range
Dim Holder4 As Range
Dim Found As Range
Dim y As Range
Dim x As Range
Dim Z0 As Range
[code]......
I was originally trying to match from the report to the data and then copy back to the report, but I had the idea of instead taking the location and vendor from the data and finding the match on the report and pasting. That way I wouldn't have to worry about errors (unless a new location was added that was not included on the report - which I think is an easier fix than trying to go the other way, but maybe not).
I have 2 sheet
1-"Check Employee Hours"
2-"Check Hours"
Below is what Check Employee Hours looks like
Below is what Check Hours looks like
I want to the user to press ebutton i.e Sunday and macro does the comparison.
Process
I would like macro to look at sheet "Check Hours" column "E" (cell E4) and compare it against the sheet "Check Employee Hours" column "E" (cell E7). If the hours matches i would like to say OK on sheet "Check Hours" cell E4, if it doesn't match then say CHECK.