Modify value according to couple of conditions - excel

I am very new to Excel and no idea if something like that is possible and if I am able to write down what I would like to achieve but let's try. Please be understanding.
I have to write down a concentration of specific reagent in an excel cell but:
if value is smaller than 0.1 such "message" should be left in the cell "<0.1".
if value is smaller than 1 it has to be rounded to two decimal places.
if value is greater or equal to 1 and smaller than 10 it has to be rounded to one decimal place.
if value is greater or equal to 10 such "message" should be left in the cell ">10".
Is smth like that doable in excel ?

You could try:
=IF(A3<0.1,"<0.1",IF(A3<1,ROUND(A3,2),IF(AND(A3>=1,A3<10),ROUND(A3,1),IF(A3>=10,">10"))))

Try this formula, just change the cell reference A3 as needed
=IF(A3<0.1,"<0.1",IF(A3<1,MROUND(A3,0.01),IF(A3<10,MROUND(A3,0.1), ">10")))

Related

Is there a formula to increment by 0.1 to an alphanumeric code in Excel, and then repeat the pattern?

I'm trying to make a column going all the way down like this:
C00
C00.1
C00.2
C00.3
C00.4
C00.5
C00.6
C00.7
C00.8
C00.9
C01
C01.0
C01.1
C01.2
C01.3
....
C01.9
C02
C02.0
C02.1
AND SO ON.
Is there a way to do this easily on Excel? So far I've just been doing the drag and drop after each x0x.0, but I'd really just like to automate this and save time. Thanks in advance!
Try this method.
Enter this formula in the first cell in which you want the number.
=TEXT((ROW()-1)/10,"""C"""& IF(MOD(ROW(),10)=1,"00","00.0"))
Adjust the -1 to the number you need, depending upon the row number and result number you want. As the formula is it will write the number "C00.1" if entered in row 2. Note that the "1" in the expression MOD(ROW(),10)=1 is the same absolute number as the "-1" just mentioned. This expression determines which is each 10th number that needs a different format.
Copy down the formula for as far as you need the numbering. You may wish to change the formulas to hard text. If so, Select > Copy > Paste Special > Values.

Formula to read text as number

Okay so as you can see each column has a value of 1-3. Currently there's just a basic formula at the end that works out the percentage by adding whats there and then dividing by the total possible if every column was 3 and then multiplying by 100.
My problem is I would like to put 'n/a' down as a result sometimes where a number value/score wasn't relevant. But when it comes to calculating the percentage it would be marked lower since it would be three less than the total possible.
So I assume there a few different ways I could tackle this problem, either by a formula that calculates the possible total based upon only the cells that have a numerical value or a formula which reads n/a as the value 3. But I can't seem to find something that works.
Please help, thanks.
You can do this:
The countif() counts the n/a and multiplies by 3 to be subtracted from the 24.
Okay I think I figured this out and the solution was far more simple that I thought it would be.
Originally the Score as % formula was =SUM(T14/24*100) 24 being the total is all cells were 3.
So what I've done is add a new column called possible total with the formula =COUNT(K14:R14)*3 As the count function only counts cells that have a numerical value, thus will ignore any cells with n/a and since 3 is the maximum value that can be entered into the cell I've multiplied the count by 3.
Then it was a simple case of changing the score formula to =SUM(T14/S14*100) where the S column will be the new possible total.

Excel calculates wrong

I have a value (B3*40*52) where B3 == $16.09. If I calculate this value manually (16.09*40*52), my answer is $33,467.20. If I use the value B3 in a formula =B3*40*52, my answer is $33,476.35. The cells are formatted to Accounting. What gives?
I've tried using SUMPRODUCT(), ROUND(), SUMPRODUCT(ROUND()), SUM()...etc.
=SUM(B3*40*52), =SUMPRODUCT(B3*40*52), =ROUND(B3*40*52), =SUMPRODUCT(ROUND(B3*40*52))...
I expect $33,467.20, but instead, excel calculates $33,476.35. If the answer was within a few cents, it wouldn't be a big deal, but this is a $9 difference.excel formulas
The value in cell B3 might not be exactly 16.09. If you divide 33476.35 by 40*52 you get 16.094399...
So if you set the cells to accounting with only two digits, Excel will round the display to 16.09. So actually Excel is right because it uses the full precision and your calculation just uses a rounded value.

Returning a blank cell if another is blank with formula already present in Excel

So I've got this system here where I'm tallying up a score difference.
Here is the formula I have for this cell:
=IF(SUM(P6:X6)>0,Y5-Z5,N5-O5)
The thing is when there is no sum (as in the cells in the formula are blank), I'm left with the 0 in this cell and I'm wanting it to just be blank like the others. The only thing is the cells it is referring to are formulas themselves, so when I've tried to do ISBLANK and such it didn't work. I want it to check whether Y5 has a number in it. If it does, then my cell does the formula above, if not, then returns blank. The only other thing is I need it to be able to state 0 as well so simply hiding 0 won't work. I'm confused as to how I can get that to do it, I'm sure there's a way though.
If it helps to understand, I'm doing a golf scoresheet. The cell in question is the total score. So could be -10 or 0 or 20. Y5 is the total strokes. I'm wanting the cell to be blank if nothing is on the scorecard. But I also need it to be able to say 0 if the score actually goes 0. P-X column is holes 10-18. The reason "(P6:X6)>0" is there, so the score only reflects holes 10-18 if those were played, whereas it will show the score relative for the first 9 holes instead if not. Hope that makes sense.
Maybe you could use ISNUMBER() for your Y5 cell.
Then, if TRUE, you use the formula.
Else, you return "".
=IF(ISNUMBER(Y5),IF(SUM(P6:X6)>0,Y5-Z5,N5-O5),""))
Is that what you are aiming for ?
Hope it helps.
Change the cell number format to,
general;general;;general
In fact, the number format couls be much more specific than that but you are short on details. The main point is that the third argument's format mask is blank. This halts the display of zero values.
A custom number works like this
<positive>;<negative>;<zero>;<text>
Test the cases separately:
=IF(SUM(P6:X6)>0,IF(AND(Y5="",Z5=""),"",Y5-Z5),IF(AND(N5="",O5=""),"",N5-O5))
You can use COUNTBLANK; it will count a cell as blank even if the cell's contents is a formula that results in blank. The formula below has holes 1-18 in columns A-R with a total in column S. If all cells are blank, the result is blank. If any of the cells contain numbers, the result is a number (zero, positive or negative).
=IF(COUNTBLANK(A2:R2)=18,"",SUM(A2:R2))
Managed through lots of trial and error to solve it myself. Thanks to all those that posted.
Here was what I came up with which seems to work well:
=IF(SUM(P8:X8)>0,SUM(Y7-AA7), IF(SUM(E8:M8)>0,SUM(N7-O7),""))

Which is the correct way of pasting?

I want to ask a very simple and maybe for some it may sound silly.
One person told that while copying and pasting in Excel you should use Paste Special and paste formats first and then values, then it keeps any leading zeros or else they will be removed. But someone else told other way round i.e. first values and then formats. I didn't notice any change also if I pasted as it is after copying.
So please tell me if these people are true and if yes which exactly is the correct order?
Oh, the joy of Excel conversions. You have to be cautious with your different circumstances.
Time to have some fun. Try this:
In cell A1 format the data as Text and enter the value 010.
In cell A2 leave the format as general and enter as 010.
Now go to the immediate window in VBIDE and execute the following:
? Typename(Range("A1").Value)
? Typename(Range("A2").Value)
A1 is a string, and A2 is a double.
If you change the format of A1 now to General then again type:
? Typename(Range("A1").Value)
It is still string - AND it still has the leading 0 at the front!
HOWEVER: now execute the following:
range("A1").Value = range("A1").Value
Although this looks like a pointless command - its effectively updates the cell by using VBA. Excel will now do the conversion to a double!!
? Typename(Range("A1").Value)
This is now a double.
So altering the format after the data can result in different data because Excel is doing a clever conversion. But this is dependant on the cell being updated. Just changing the cell format might change that value, but not necessarily - and later it could change if a user presses F2 and enter on the cell. Lovely - thank you excel for being intelligent.
Don't even get me started with other conversions.
So, I suggest that in the majority of cases, you should actually format first and data after.
Happy pasting! :)
Cell value and cell format are two distinct properties of a cell in Excel.
For displaying values, excel applies the format of the cell to its value. So if your cell holds a number and the format specifies that the number should have leading zeros, the number will be displayed with a leading zero. This does not change the underlying value!
The format affects only the display.
As an example:
Let's say your cell holds the value 5.5 as numerical value. Applying the format 0.00 will display that value as 5.50. Applying the format 0.00 min will display the same value as 5.50 min. But the value itself is still unchanged 5.5 - this way, you can e.g. be very specific about how you want to display a number, but still use its plain value for calculations. Same principles apply to every other formatting rule and data type of course.
So no matter which way round you paste - as long as the cells end up with the correct combination of value and format, you will end up with the correct result.

Resources