I am trying to obtain the highest and the lowest values within a data set and record each instance. I have used the following spreadsheet to do this.
I want to obtain the lowest occurrence and if there are one or more values that are the same it will list those values too. However, when I use what I have I cant get the numbers to stop listing.
I am Assuming this is because The numbers are not the same exact values to the number of decimal places the original data comes from. e.g. the lowest value is 21.5 but the raw data gives it to 21.498 etc.
I tried using the Round function but it merely changes the formatting of the cell.
Has anyone found a way around this?
*Edit*****
I only want to report the lowest value, and if there are multiple occurrences of the same number (to one decimal place) then record those as well. The issue is that I don't know how to tell excel to stop the list if the values are the same to 1 decimal place. I tried the round function but it only changes the formatting of the cell not the actual number so excel thinks they are different values. I am not sure how to get this to work.
G3 is the top cell with =IFERROR(SMALL($C$3:$C$101,A3),"") in it.
=IFERROR(SMALL($C$3:$C$101,A3),"")
=IFERROR(IF(SMALL($C$3:$C$101,A4)=G3,"",SMALL($C$3:$C$101,A4)),"")
the data is;
And I need the highest and lowest data to 1 decimal place.
This should fix it:
G3:
=IFERROR(ROUND(SMALL($C$3:$C$101,A3);1),"")
From G4 onwards:
=IFERROR(IF(ROUND(SMALL($C$3:$C$101,A4);1)=G$3,"",ROUND(SMALL($C$3:$C$101,A4);1)),"")
You can use an Array function (entered with Ctrl+Shift+Enter):
=SMALL(ROUND($C$3:$C$20,1),A3)
And for the matching serial number:
=INDEX($B$3:$B$20,MATCH(SMALL($C$3:$C$20,A3),$C$3:$C$20,0))
Here are the results (formatted with 3 decimal places just to prove the values are properly rounded):
Related
I want to use Excel to generate random numbers between 1 and 10 and then count how many numbers were generated for each number to be generated.
I know how to generate random numbers, i.e. =RANDBETWEEN(1,10)
and then just pull down the corner.
But it's a bit of work to manually go through the list checking when all the numbers were generated.
Is there an easier/automatic way to do this ?
Assuming you have a header you could use:
Formula in A2:
=IF(SUM(--ISNUMBER(MATCH(ROW($1:$10),A$1:A1,0)))=10,"Done: "&ROW()-2&" numbers made",RANDBETWEEN(1,10))
Note that this is an array formula and depending on one's version of Excel you need to accept it through CtrlShiftEnter.
Drag it down, but remember that RANDBETWEEN is volatile and will recalculate each time you insert a new value.
If you have an existing list of random numbers in the range 1 to 10 and want to check it to see at what point all of the numbers in that range have been generated, you could use a formula like this:
=MATCH(10,MMULT(SIGN(COUNTIF(OFFSET(A1,0,0,ROW(1:100)),COLUMN(A:J))),ROW(1:10)^0),0)
assuming that there are up to 100 numbers.
Must be entered as an array formula using CtrlShiftEnter in less recent versions of Excel.
The idea is to use Offset to select an increasing number of rows from the range, then use Count to test for the presence of each number and Mmult to get the total of different numbers for each range. The use of the volatile function offset is normally deprecated, but since the sheet would already be using another volatile function, Randbetween, there may not be much additional effect on performance.
I have a list of temperatures and I need to list the smallest value in the array and then record the associated serial number in the column to the left. The issue I am having is that the numbers can occasionally be the exact same number so there are multiple smallest values that need to be recorded.
I have used the following to get the smallest value in the array;
=IFERROR(IF(VLOOKUP(D4,$D$4:$I$150,3,FALSE)="YES","",ROUND(SMALL($E$4:$E$102,C4),1)),"")
I have used the following to get the serial number for that temperature;
=IFERROR(CELL("contents",INDEX($D$4:$D$102,MATCH(IFERROR(SMALL($E$4:$E$102,C4),""),$E$4:$E$102,0))),"")
I have then attempted to get the next smallest value by using this in the cell below (which works);
=IFERROR(IF(VLOOKUP(D5,$D$4:$I$150,6,FALSE)="YES","",IF(ROUND(SMALL($E$4:$E$102,C5),1)=M$4,ROUND(SMALL($E$4:$E$102,C5),1),"")),"")
However, when it comes to getting the serial number associated with each of the duplicates I cannot think of a way to relate the two together.
I was wondering if there was a way of getting the cell reference for each instance of the small function and then offseting the column? To do this I attempted to use the Cell function coupled with the aggregate function but I just get an error so I dont think it is possible in this way.
Does anyone have any suggestions of an alternative way to do this?
Thanks
If one has the Dynamic Array formula FILTER(), put this in L4:
=FILTER(D:E,E:E=MIN(E:E))
IF not:
Put this in L4 and copy over and down
=IFERROR(INDEX(D:D,AGGREGATE(15,7,ROW($E$4:$E$102)/(($E$4:$E$102<>"")*($E$4:$E$102=MIN($E$4:$E$102))),ROW($ZZ1))),"")
Question: Is the COUNTIF function working inconsistent with different data types and cell formats?
The situation:
Column A contains manually created numbers (to be used in SAP). The numbers are 18 characters long, don't contain any non digit chars. The cell format has to be Text as we would face more issues down the line if it wouldn't. If I apply the formula =COUNTIF(A:A;A2) the result is as shown in column C. However this obviously not the correct result.
Another example with "real" test data from a system extract:
The issue here is, that the COUNTIF function sometimes returns the correct result, sometimes a wrong result. I cannot figure out why its working the way it does.
Also I did not find any satisfying result somewhere else on the Internet. If I missed something, please let me know.
As a side note: If I transfer the data into a PIVOT table it always shows the correct results.
Problem:
This will most likely be due to floating point errors.
Excel's COUNTIF function will try to handle these values in A column as numbers. Because Excel uses IEEE 754 specification on how to store and calculate floating-point numbers, Excel therefore stores only 15 significant digits in a number, and changes trailing digits after the fifteenth place to zeroes. Source.
For example:
541235479876536549 will become 541235479876536000
541235479876536550 will become 541235479876536000
541235479876536551 will become 541235479876536000
541235479876536552 will become 541235479876536000
That would mean your values are 3 digits too long to be handled accurately. In this example, the unique values will all be counted 4 times using COUNTIF.
Removing the last three digits from your string should therefor make the COUNTIF behave as expected. However, this will still give you unwanted results as you don't want to mess with the original data.
Solution:
If using a pivot table (which probably works as it should pick up the data as text) is not what you want, maybe you can use:
=SUMPRODUCT(--(A$2:A$11=A2))
Note: On a large dataset, array-formulas might slow down your
workbook significantly!
Furthermore, COUNTIF is not the only function that would suffer from this behaviour. The scope of this problem included functions like SUMIF, SUMIFS, COUNTIF, COUNTIFS, AVERAGEIF, and AVERAGEIFS. Source
I have a column which has positive and negative numbers. I want to find the sum of them. All the values are in Number datatype.
When I use auto sum, I get 0.00 as my result.
Column Image
Also, the values in the column were populated from another columns (like =B2-C2)
However, if I copy and paste the values alone in another column and sum it up, I get the desired result
I agree with BigBen, it sounds like your data is in text format. Even though you change the format on the "Home" tab to "Number", it still might be read by Excel as text.
To quickly change all text "numbers" to real numbers, select the range of numbers and use the "Text to columns" feature under the "Data" tab.
Try making sure that your data is being interpreted as numbers.
For instance, use in E2 "=2*D2". You should get the corresponding number.
Do the same for all your sources cells.
(Given that you mention that these are results from calculations, I expect these to be actually numbers).
If any of the results gives you trouble, you already have the source of your problem.
If all the cells contain numbers, try using in F2 "=SUM(D2:D2)" and expanding the range one cell at a time.
You should be able to identify the source of the problem.
You may help others help you by making your workbook available somewhere online.
You don't need autosum, just SUM (which is anyway the function setup by autosum).
I'm using Excel to run a sort of lottery.
The spreadsheet columns are set up thus:
COL1:Person Name; COL2: Chosen Number A; COL3: Chosen Number B; COL4: Chosen Number C
There is then a set of data, generated using RAND() and ROUND, that gives 3 winning numbers, each between 0 and 10.
What I'm trying to do is identify a winner, by using VLOOKUP or INDEX/MATCH, or some combination, or other function, to identify the winning person, so that there is a single cell that returns the name of the winner.
The added complexity is that by looking up each of the numbers individually by column, an individual selection of, say, 1,4,8, isn't a winning selection against a randomly selection of say, 4,8,1.
Ideas?
You can concatenate numbers to additionalcolumn so it will contain string "1,4,8," and then perform a VLOOKUP for concatenated in the same way winning numbers.
By the way, this solution will show only first person, but isn't it possible that several persons guessed same numbers and won?
If you want to generate a 3-digit number, by far the easiest thing to do is to use the formula
=RANDBETWEEN(0,999)
You can select the cells and then enter (via the format dialog accessible by right-clicking) the custom format 000 if you want it to display as 3 digits so that e.g. 7 displays as 007. This will allow you to directly use VLOOKUP on a single value. #kipar asks an excellent question about potential multiple winners.
I implemented the abovementioned solution and it was quite easy. After your 4 columns, you add one column with
=TEXT(B1;0)&TEXT(C1;0)&TEXT(D1;0)
which combines the number to one string. Then you put your winning number in a cell of preference mine was M28 and the value was 123. After your first five columns you use the following formula.
=IF.ERROR(INDEX(A$1:A$4;SMALL(IF(E$1:E$4=TEXT($M$28;0);ROW(E$1:E$4));RI-OW());1);"")
The IF.ERROR is used to put a blank when there are no multiple winners. The index is used to get the winners out of your first column, that'w why there's a one at the end. The small is used to find the first occurence of the winner. You also have to enter it as an array formula so press ctrl+shift+enter instead of just enter when the formula is completed. I hope this answer is satisfying.
PS. For extra information on the use of this function go here: http://chandoo.org/wp/2014/12/09/multiple-occurrences-lookup-and-extraction/