I have an Excel file with over 5k+ rows and numbers.
I want to check these 5k+ numbers to see whether they have any "problems" within them (not errors such as #DIV/0, etc, those have already been accounted for).
So for example...a problem would be having a space in front of a number, causing that number to not be added to the sum of all numbers, etc... not logical errors, but more input errors. iserror would not work in this case, as it isn't a logical error.
Is there a way to do this automatically? Thanks!
Suppose all your numbers are in column A, starting at A1.
You could then in B1 put in the formula =Value(A1) and drag it down.
Then, just filter column B for #VALUE - That will give you all the numbers from column A that aren't seen by Excel as numeric.
Hope this helps!
On testing, Value() does its best to convert a value to a number, ignoring initial spaces or an apostrophe. I might use =ISNUMBER() in preference.
If you highlight the cells, say A2 downwards, you can create a Conditional Formatting, New Rule, Use a Formula, and enter =ISNUMBER(A2); choose some formatting for these cells.
Related
I have two columns to compare. All cell values come from the ROUNDUP function. =ROUNDUP(C6/D12,0) etc.
I want the larger, or equal, of the two in each row to be green and the smaller red. Using the formula, it does not work as expected. If I do the same with numbers typed, not the formula, it works. It appears the formatting applies to the formula and not the value.
That is the first half of the problem. I also want to autofill/paint the conditional formatting to numerous cells, but it always compares to the top left cell, rather than the two cells on the same row.
If I use the color scales formatting it works, but I do not want the scales, just red/green.
It seems hard to believe that what I want to do is not possible. Can someone please help me with this. Thanks in advance.
In conditional formatting, under 'use a formula to determine which cells to format', you need to enter
=A2=MAX($A2,$B2)
to highlight the larger cell and (as a separate rule)
=A2=MIN($A2,$B2)
to highlight the smaller cell.
Note that in the case where both cells have the same value, they will both be either coloured red or green depending on the precedence of the rules. If the 'green' rule comes first,
it will look like this:
Conditional formatting is almost its own little science within Excel. It may be more useful to find youtube tutorials on the topic than depend on a text explanation here. But the central theme is this.
You will use location locking (the dollar sign or F4) in front of the letters so that any cell to which the format is applied knows you specifically mean columns E and F, for instance.
Example: Assume your first row goes from A5 to M5, and the condition values are in E5 and F5.
I find it easiest to format one row with the rules I want, test them, and then use the format painter or copy -> paste format along with careful use of $ locking.
Drag over and select the entire row of cells A5:M5
Conditional Formatting -> New Rule -> Use a formula to determine which cells to format
In the formula field enter =$E5>$F5. Excel gets weird and often inserts double quotes. If you save the rule and go back in, it may say ="$E5>$F5" and if so delete the double quotes.
Click Format and create the cell format you want.
With A5:M5 still selected, add another rule and format for ="$E5<$F5"
The $ sign works the same way as it does in a formula. All of the columns get their format based on columns E and F, but all of the rows base their formula on the E and F values in that same row.
So... this is going to be a difficult explanation...
I am using a barcode scanner to enter a 20 digit number into Excel. Due to the limitations of Excel this has to be done as text, since Excel only allows up to 15 digits.
This means that my cell has a shown value of example 00257108402007839772 but the value "behind" the cell is 257108402007839000 (the last 3 digits are turned to zeros).
I have to check the values for duplicates, and the last digits are in most cases the digits that differentiate the numbers from each other. This means that when doing a conditional formatting on the cells, the most part of the numbers are flagged as duplicates.
So my question is basically - do you know of a way to search duplicates on the shown value, and not on the "real" value of the cell?
I hope this makes sense....
Here is something for you to consider:
As you can see COUNTIF() does not work on these values, but SUMPRODUCT() will when we just directly compare a range against a single cell. Below you'll see an example of conditional formatting:
Rule used on range A1:A4: =SUMPRODUCT(--($A$1:$A$4=$A1))>1
I have two columns in my excel, Date 1 in A and Date 2 in B. I'm trying to find the number of times Column B is greater than Column A. I'm using the formula =SUMPRODUCT(((B2:B5-$A$2:$A$5)>0)*1) and receiving an error. The error is due to the data in Column B is being pulled in from a formula, where my value_if_false is "". While the cell is blank, Excel sees this as data and will not execute my original formula.
If I go to B4 and delete the value, my original SUMPRODUCT will execute. I'd like not have to go back and do that. I've tried =SUMPRODUCT((NOT(ISBLANK(B2:B5-$A$2:$A$5)>0))*1) but it's returning 0. Any suggestions?
Try following array formula:
{=SUMPRODUCT((IF(IFERROR(VALUE(B2:B5);FALSE); B2:B5;0)>$A$2:$A$5)*1)}
Array formula after editing is confirmed by pressing ctrl + shift + enter
Writing "" (nul string) to a cell that is supposed to contain a number (such as a date) is never a good idea because it leads to problems like this one. The solution is in not writing a string (text) to a numeric field. Write zero instead, and then deal with the display of zeros via global settings or cell formatting.
Of course, any date would be greater than zero. If this leads to the wrong count the obvious remedy would be to make a second count of instances where zero is involved and deduct the result of the second count from the first, like, SUMPRODUCT(1)-SUMPRODUCT(2)
I guess if you wanted to stick with SUMPRODUCT and avoid array entry, you could try
=SUMPRODUCT((B2:B5<>"")*(B2:B5>A2:A5))
or to exclude anything except a number (which in this case would be formatted as a date)
=SUMPRODUCT(ISNUMBER(B2:B5)*(B2:B5>A2:A5))
is possibly better.
B4 contains "", not ="".
I'm having a problem writing my formula that should count all selected cells that contain a number bigger than 0 and skip the cells that are completely empty, even when the cell is selected. Excel gives me an error that I selected cells that not contain a number. How can I skip them?
This is my formula:
=COUNTIFS(C8:C12;E8:E12;G8:G12;I8:I12;K8:K12;">0")
I'm thinking you using the COUNTIFS() formula wrong, after each range, there is a criteria. You can't have multiple ranges like that to look through. For more information look here or here.
In your case you are dealing with a non continues range, and one way to deal with that would be this
So the formula would translate to:
=SUM(COUNTIF(INDIRECT({"C8:C12","E8:E12","G8:G12","I8:I12","K8:K12"}),">0"))
Another formula you could try is:
=INDEX(FREQUENCY((C8:C12,E8:E12,G8:G12,I8:I12,K8:K12),0),2)
And looking at your data, it seems as though the rest of the columns contain text (not sure, they may be dates). In case they are text values:
=SUMPRODUCT((ISNUMBER(C8:K12))*(C8:K12>0))
If they are actually dates (assuming from 2018), then you could try:
=SUMPRODUCT((YEAR(C8:K12)<2018)*(C8:K12>0))
I'm assuming this is what you looking for, instead of a VBA based solution due to the tags provided and your formula.
You could also do it in this particular case by skipping the columns that you don't want:
=SUMPRODUCT((C8:I12>0)*ISEVEN(COLUMN(C8:I12)-COLUMN(C8)))
what will be happen if you use the below formula? to you receive an error?
=COUNTIF(C8:C12,">0")+COUNTIF(E8:E12,">0")+COUNTIF(G8:G12,">0")+COUNTIF(I8:I12,">0")+COUNTIF(K8:K12,">0")
Try this
Requirement cannot be done in single formula,
combining 2 or more formula will help fixing the formula.
formula
=COUNTA(B2:B9,D2:D9) -- Count all the non blank cell's
=COUNTIF(B2:B9,"=0")+COUNTIF(D2:D9,"=0") -- Count all the cells will value as 0
Subtract both which will give the output you are looking for
Combined formula
=COUNTA(B2:B9,D2:D9)-(COUNTIF(B2:B9,"=0")+COUNTIF(D2:D9,"=0"))
I made cell A1 equal 1.39139
Made cell B1 equal 1.40596
Made cell C1 a formula =(A1-B1)*10000
Copied cell C1 and pasted it by value into cell D1
In cell E1 I wrote manually the real result of the calculation, which is -145.7 (you can try using a calculator).
In cell F1 I made an if statement to compare the results of E1 and F1: =IF(E1=D1,"equal","not equal")
The result is "not equal".
**I want to know how to copy and paste a formula and make sure its pasted result will be exactly the same. keep in mind that I don't want to use =round() formula because I need a solution for many numbers, and I can't use round() for each cell with different number of digits.
As already pointed out, this is because of Excel's floating point precision.
You are correct that (1.39139-1.40596)*10000 is equal to -145.7. However, I tried typing this into Excel to see what it actually produced and I found the following. If you highlight your cell C1 and press F9 on the keyboard you will see that Excel actually computes this value as -145.700000000002.
I know you said you don't want to use ROUND but, aside from avoiding floating point numbers altogether (i.e. only using integers), I think ROUND is your only option.
I suggest that you determine what is the maximum number of digits after the decimal you will ever need in your sheet, and incorporate ROUND(<number>,<max digits>) into all formulas as necessary.
i.e. instead of using =(A1-B1)*10000, you should type =ROUND((A1-B1)*10000,5) (for example to round to 5 digits) which would return the value of exactly -145.7. I hope this helps, or if nothing else, I hope this at least shed light on what is causing this.