IF Comparison Function Not Returning Correct Data
Jan 24, 2014
I'm trying to compare three formula results and return the largest number. Ex.:
2217922
The first three numbers are formula results and the last is the following formula:
=IF(O5>P5,O5,IF(P5>Q5,P5,Q5))
Unfortunately, with the list below, you can see the last number (the comparison formula) isn't always the greater of the three:
2217922
2017920
01799
01399
01399
01299
01299
01299
01299
01199
01199
01099
0088
0077
0077
I've also tried other formulas, with no success:
=LARGE(O5:Q5,1)
=MAX(O5:Q5)
=IF(MAX(O5:Q5)=O5,O5,IF(MAX(O5:Q5)=P5,P5,IF(MAX(O5:Q5)=Q5,Q5,"Error")))
What's odd is that if I create the formulas above independent of the specific formula data (O5, P5, and Q5) and just type in numbers, those formulas do exactly what they should. Can I not compare data returned though formula calculations?
View 12 Replies
ADVERTISEMENT
Sep 29, 2012
I am currently using the Match and index functions to search for specific criteria and return specific data based on that criteria. The problem is the formula is returning the first value at the beginning of the month rather then the end of the month value that I am asking for. I have my criteria set to zero so it should be a perfect match. with the live worksheet I have several tabs for different years. I want to take the end of month balance on each of those year tabs for each month in each fiscal year and add them together. My formula only has the one month because I am unable to get it to work much less adding in all of the years information. I have the employees choosing EOM for the last transaction posted during that month and that calculates the month number in the field next to it. I was thinking I could use the match to look for a specific month in that column and return the balance adjacent to it at that point.
View 7 Replies
View Related
Mar 20, 2013
In an excel sheet, I am using a macro to filter. Macro code is as follows. When I run this macro, it returns 4 rows matching the criteria from 560 rows in the excel sheet.
VB:
ActiveSheet.Range("$A$1:$I$566").AutoFilter Field:=1, Criteria1:= _
">=11/11/2012 22:13", Operator:=xlAnd, Criteria2:="<=11/12/2012 6:47"
I want to use the same criteria in the vb.net code, to do same thru vb.net. But, when I run the same code in vb.net, it just returns only 1 row (1st row only).
VB:
[FONT=Consolas][SIZE=2][COLOR=#0000ff]xlsRange1.AutoFilter(Field:=1, Criteria1:=">=11/11/2012 22:13", Operator:=Excel.XlAutoFilterOperator.xlAnd, Criteria1:="<=11/12/2012 6:47")
This returns 1 instead of 4 expected.
View 2 Replies
View Related
Dec 24, 2008
I'm trying to do a comparison amongst several cells and returning a 1 if true. if D25 is blank or does not equal Yes, Mixed or SP3, and if both F25 and G25 are blank, the output the value 1. First try:
=IF(AND(D21="",D21<>"Mixed",F21="",G21=""),1,"") - This seems to ignore the Mixed and outputs a 1 even if D21=Mixed.
Second try:
=IF(AND(OR(D25<>"Yes",D25<>"Mixed",D25<>"SP3"),F25="",G25=""),1,"") - same as above, if D25=Mixed then value of the cell is 1.
View 2 Replies
View Related
Nov 4, 2011
I am trying to count how many entries in a worksheet say "yes" depending on a value in another column - formula is:
=IF('PM Tracker'!$D$3:$D$1000=C15,COUNTIF('PM Tracker'!$V:$V,"Yes"),"None")
Value in cell C15 is equal to "43-11" (week number and year)
This keeps returning "none" as the answer but I know 3 entries satisfy the "yes" criteria in Column V for week 43-11.
View 3 Replies
View Related
Jul 28, 2006
I have a querytable running on my sql database. In the query I have a trimleft function because the numbers are stored with several proceeding blank spaces. When I execute the query through my macro, everything works fine, except I can't average or sum the results. They can be multiplied, divided, etc, but not averaged or summed (they just show as zero on summing, which makes the average DIV/0). The really strange part is that if I select a number and go to the formula bar and hit delete at the beginning of the number (which actually deletes nothing), the number is suddenly capable of actually performing as a number. I assume this has something to do with how the querytable is returning my results, but does anyone have an idea for a workaround for this issue?
View 3 Replies
View Related
Jan 26, 2014
We receive about 20 sales files of several hundred lines of data each day from various agencies. I want to create a macro / VBA code which checks that the data submitted is correct so that we can upload it into our database without import errors and / or having to manually check each line of data.
I envisage something like an output report:
#####################
149 entries
Column A - Date - OK
Column B - Customer_Phone - Errors (Should be 11 digits)
Row 21 - Customer_Phone - Error (Not 11 digits)
Row 108 - Customer_Phone - Error (Contains letters)
Column C - Outcome - OK
Please correct and re-check.
#####################
View 4 Replies
View Related
Aug 2, 2006
What I am trying to do is have a macro that do a comparison between 2 cells every 100 milliseconds. One of the cell is constant updating from RTD (Real Time Data). And if its false, to nothing. However if true, I would want it to run some codes and exit the macro/procedure. I also need some way of stopping the macro at any time.
View 6 Replies
View Related
Jun 1, 2009
it returns an error when I try to enter it. Is there a brave soul which a good eye for errors that might be able to shine some light on the error. Currently it appears the error centers around the MONTH( ) portions of the function. But each embedded function is able to stand alone and I can't imagine why they won't work together.
View 4 Replies
View Related
May 24, 2012
I'm trying to add the total product sold by a group of sales person for example : Chad + Javier. My actual worksheet includes 600 rows of salespeople and 20 rows of product, i'm using this simple example to get the message across.
I was using =sum(sumif(A1:A9,"Chad',D1:D9),sumif(A1:A9,"Javier",D1:D9)), the formula should have given 91, but instead is calculating 113...
Salers PersonProduct AProduct BProduct C
Chad567
Chad567
Chad567
Chad567
[Code] .....
View 1 Replies
View Related
Feb 22, 2013
Is it possible to see why this code returns a date that is almost correct? Searching for 01.01.2005 I get 01.11.2005 as result. I would like the code to only show the correct date, and if it doesn't exist it should end up showing "nothing".
Code:
Set fstdate = wsOBX.Range("B1:B" & lr1).Find(what:=startdate, _
LookIn:=xlFormulas, lookat:=xlPart, SearchOrder:=xlByRows, _
SearchDirection:=xlNext, MatchCase:=False)
View 3 Replies
View Related
Mar 27, 2009
I have two columns of items that need to be compaired. What I need is the items in column B that do not match any of the items in column A need to be put in Column C. How can I do this? The Data in Column A can not be re arranged. Column B can be sorted.
View 9 Replies
View Related
Jul 28, 2009
I have a spreadsheet and I'm comparing data from a room booking system and a spot check on the room to see whether it's actually used. I have a column which I want to show whether the information agrees.
column G - I have a group size recorded that should be in a room.
column H - I have "yes" or "no" as to whether there was anyone in the room when it was checked
column I - I have the size of the actual group in the room.
Is it possible to create a formula that will fill in column J with the answer yes or no depending on whether it agrees.
It doesn't matter whether the groups sizes match, it's just a case of yes, someone was booked into the room and there was someone in when it was checked
OR
No, there was a booking supposed to be in the room but there was no one in it when checked
OR
There was no booking but there was someone in the room when checked.
View 4 Replies
View Related
Mar 22, 2007
With a set of data in colums by quarter and department names in by row I need to answer build a formula that answers simple questions like "what department had the fewest sick days per quarter?" and which department had the most sick days per quarter?"
View 4 Replies
View Related
Dec 18, 2013
I have a database with 65536 rows and A-BZ columns
What I am wanting to do is, on another worksheet be able to select identifying data from one or more columns from the database but have it display the entire row.
For example
WCP28 SX
WCP28 TX
WCT36 SX
WCT36 TX
In this example I would like to, on another worksheet, be able to create a drop down where I could select WCP28 and it would show me both the TX and SX row. Or I would like to be able to select WCP28 SX and WCT36 SX and see the rows next to each other. If it were for me I would just use the auto filter and manually compare but this is for somebody even less inclined than I am.
View 5 Replies
View Related
Dec 2, 2005
I would like to insert a function in spreadsheet A that looks up data in
spreadsheet B based on _two_ comparison values.
The two comparison values in spreadsheet A would always be in the same row
and the corresponding match in spreadsheet B would also have to be in the
same row.
For instance, if the comparison values in cells A2 and B2 of spreasheet A
match with the comparison values in cells A30:B30 of spreadsheet B, then
show the value that is in column C30 of spreasheet B.
View 9 Replies
View Related
Mar 17, 2014
Excel macros. I'm trying to figure out a script that will look at alphanumeric numbers in column A (A2 --> for example) and compare it to the number directly below it and above it. If it matches either, do nothing, but if it is different, delete the entire row that the different number resides on.
An example of the data would be:
A
12A34A5
12A34A5
67F86F3 - when it encounters these rows I need to delete.
23G45G6
23G45G6
The sheet is a couple thousand lines in length, so I can't deal with it manually or even with sorts, due to the other data in the other columns.
View 9 Replies
View Related
Oct 23, 2006
I am trying to figure out a way in excel to graph some data I have in a new, sophisticated type of chart. My data is new square foot sales divided by new square feet (for a retail store). It is a dollar amount. I also have this data as a percentage change year over year. If I want to compare two stores with different data -- what would be the best way to present it on a chart. Is there a way to show this on a 3-D plane so that both companies have the data in the same chart up against each other?
View 2 Replies
View Related
May 7, 2008
I have some data stored in a database and when it is extracted into excel each entry's data is presented in both horizontal and vertical formats. e.g.
Entry1 value1 value2 value3
value4
value5
value6
Entry2 value1 value2 value3
value4
value5
value6
I have a macro that will transpose the vertical data into horizontal format but if there are not the expected number of 'value' items below the entry it will not work correctly. If in the above example Entry2 only had value4 and value5 below it the macro would fail.
What I need is a way to validate that each entry has the correct number of values below it before the macro is run and some way of highlighting or drawing attention to these problems.
View 9 Replies
View Related
Jun 27, 2008
I want to be able to do, however. I want to make a spreadsheet that has all the equipment items preloaded into it, along with the quantity that we're supposed to have of said equipment. Then, I would like to import the data from the text file, having it match items in the spreadsheet to their equivalent in the imported text file, and then bring in the quantity scanned. That way, I can use some conditional formatting to show when there is a miss match between "Required" and "On-Hand" quantities.
What I don't know how to do, is get Excel to only import the name of the item, and the quantity scanned, instead of all of the information that the scanner spits out. Also, I don't know how to make it match the name, with the one preloaded into the spreadsheet, so that the correct quantities are matched up. Here's an example of what the scanner spits out: FIELD WIRE,6145-01-155-4256,[Scanned Quantity Goes Here],N/A,N/A,RESPONSE TRAILER,,
The scanner creates records like this the first time you scan an item. So if you scan Field Wire first, it's the first record. However, if you scan it fourth, it's the fourth record. How do I make that match up with a predesigned spreadsheet?
View 2 Replies
View Related
Mar 10, 2014
I'm interested in comparing the 2 columns of data as attached in the SampleData file, for eg. First customer bought 5 items and customer 2 bought 3 items. I'd like to show the difference which customer 1 bought and customer 2 did not buy. Will need to use that via VBA And also for loop if possible!
SampleData.xlsx
View 6 Replies
View Related
May 20, 2014
I'm working on a workbook that will track staffing patterns.
The workbook has three worksheets: Sheet1 "RCS", Sheet2 "HCT' and Sheet3 "Hidden". I've attached the workbook to this thread. The password for the form is "j".
On Sheet3 "Hidden" I have two tables that are set up to collect the SUM of columns on Sheets1 "RCS" and Sheet2 "HCT". I'm finding the SUM of each range by way of the background color. I've set up the following formulas and when the "data collection tables" are in the same worksheets as the original information, the formula's work perfectly:
The following functions are pulling data from Sheet1 "RCS" and placing them into a table in Sheet2 "Hidden"
[Code] ........
The following functions are pulling data from Sheet1 "RCS" and placing them into a table in Sheet2 "Hidden"
[Code] .......
I have two more functions that aren't working due to the fact that the source values are percentages and NOT plain numbers. The above functions work great for SUM but not for percentages. EXAMPLE--Let's say, 3 sub percentages it gives me the SUM of the 3 percentages (i.e. 85% + 100% + 100% = 285% instead of giving me 95%.
[Code] ........
How might I use the following functions to find the average of the source fields instead of the SUM?
View 7 Replies
View Related
Sep 17, 2008
I have an IF Function that if C4 says HUD then it returns the infor in a range of cells on the HUD worksheet, which is a separate worksheet from where this formula is {=IF(C4="HUD",HUD!A1:C100,"")}. I have also used =IF($C$4="HUD",HUD!A1,"").
But now, on the cells that it is returning, it puts 0 in cells that are blank on the other worksheet. What can I add to this formula to eliminate that?
Both of these functions are working otherwise. They are just returning 0 in cells that were blank.
View 9 Replies
View Related
Feb 15, 2010
I'm trying to create a formula that will added the correct amount in the correct cells, I have create a dunny sheet in trying to achieve this. If Cell B8:B11 = ABS or Dum that any points won should be added to Cell L8:L11 right now its adding it into K8:K11. If Cell B8:B11 = is Blank any player points should be added to cells K8:K11. I'm using this formula throughout cells K8:K28 =IF(J8>J25,1,IF(AND(J8<>0,J8=J25),0.5,0)) Any thing in red is incorrect anything in blue is what I'm trying to achieve.
View 4 Replies
View Related
Jul 3, 2008
I have a table with 3 columns of dates and then a column with Set # that I
feel in the box #.
I need to see how many items processed for each set per day.
Example:
[url]
The problem is that it counts the correct amount but not with the correct
dates.
The formula that I use is:
=SUMPRODUCT(--($I$3:$I$8<>"")*(($C$3:$C$8=39601)+AND($E$3:$E$8=39601)+AND($G$3:$G$8=39601)))
View 14 Replies
View Related
Nov 7, 2008
I'm trying to figure out an Internal Rate of Return for a spreadsheet. The answer is supposed to be: 29.42% however I'm getting 25.94%. Does anyone know what I'm doing wrong in my IRR function on the Profitability worksheet? I'm currently using Excel 2007 by the way.
View 4 Replies
View Related
Apr 24, 2014
trying to create a 'countdown' to time of macro completion (based on a static performance time of 1:48). What I want to do is compare a time (ProgTime) set as static at the beginning of the code with 'TIME' and return the difference in seconds. I use the following code:
[Code] ....
When I step through, I can see that ProgTime and Time have different values and yet 'Test' always returns a value of '0'. I tried using 'Now' instead of 'Time' and the same result ('0') occurs. I have experimented with declaring 'Test' as an integer, a long and a date and the result is always the same! I've tried using 'Seconds() around the datediff to ensure an answer in seconds, I've tried 'format' around it with multiple decimal places to make sure I'm not missing a tiny value: Nothing seems to do the trick!
View 13 Replies
View Related
Aug 18, 2009
I am new to VBA programming in Excel (currently 2003) so hopefully this isn't a "dumb" question.
I would like to re-arrange a group of data from a table of several rows and columns to a single column where the data from the first row is translated to a column then the second row is appended to the end of that data ....
ie:
( 1 ) ( 4 ) ( 7 )
( 2 ) ( 5 ) ( 8 )
( 3 ) ( 6 ) ( 9 )
to
( 1 )
( 4 )
( 7 )
( 2 )
( 5 )
( 8 )
( 3 )....
I thought a user defined formula would be a good place to start but am having problems getting the address of the cell that the function resides in to use to calculate the offset from a fixed cell (to be entered into the function as a argument). In other words, how do I get the address of the call that a UDF is entered in into the UDF? activecell.address is returning the cell that was last clicked not the cell were the UDF resides.
Secondly is there a better way to achive the results that I am looking for other than through a function? The size of the table will vary from worksheet to worksheet. I would also like to add an argumnet that lets me exclude cells with certain content from the resultant list.
View 6 Replies
View Related
Sep 1, 2013
I have 2 Data tables in 2 sheets of the same workbook. I want to compare my column A of table 2 with column A of table 1 and delete any rows of table 2 where (column A of table 2 has a value which is not in the column A of table 1)
In Excel I used the Vlookup function and deleted any rows which had Error in result of the formula. May I know how to execute this in VB
View 3 Replies
View Related
Sep 2, 2009
I have data concerning documents people have to write, which is updated weekly. Is there a way of looking up a name and then returning all the documents that they have to write. I have tried a vlookup, but this only returns the first entry and not the lot. Also i would prefer the document data for each person to be returned in to one cell.
View 3 Replies
View Related