Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
On one sheet I keep track of the lottery numbers every week. On anothe
sheet I try to keep the statistics of these numbers, like how man times and how many drawings ago a number ........ The how many time was no problem, with a COUNTIF....but the how many drawings ago doesn't work. I tried an IF (sheet1!A1:A6="number",sheet2!A1+1 sheet2!=1. But then I get a circular reference statement. How do proceed???? -- Message posted from http://www.ExcelForum.com |
#2
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
"knoertje " wrote in message
... On one sheet I keep track of the lottery numbers every week. On another sheet I try to keep the statistics of these numbers, like how many times and how many drawings ago a number ........ The how many times was no problem, with a COUNTIF....but the how many drawings ago, doesn't work. I tried an IF (sheet1!A1:A6="number",sheet2!A1+1, sheet2!=1. But then I get a circular reference statement. How do I proceed????? I'm not sure if this is what you are hoping to do, but just using worksheet functions without VBA, this seems to do what I understand you are asking about. If you have 5 columns on the worksheet like this: Col A Col B Col C Col D Col E Number Times Drawn Date Weeks Ago # weeks ago this was drawn 25 2 4/24/04 1 4 31 3 4/17/04 2 3 31 3 4/10/04 3 6 25 2 4/3/04 4 66 3/27/04 5 31 3 3/17/04 6 Col A says what number was drawn. A countif function in col B shows how many times it has been drawn in previous drawings. Col c is the date of the drawing, col D is how many weeks agao it the drawing was held and Col E says if a number was drawn more than once, how many weeks ago from today did it last get drawn. So the spreadsheet shows that 31 has been drawn 3 times. The last time it was drawn was 3 weeks ago and the time before that was 6 weeks ago, both calculated from today (i.e. when I say that on April 10th the number drawn was 31 and the previous instance of 31 was 6 weeks ago, it is 6 weeks ago today and not 6 weeks ago to April 10). If this is what you are envisioning, here are the functions I used: for the countif function in column B: =IF(COUNTIF(A$2:A$7,A2)1,COUNTIF(A$2:A$7,A2),"") For the function in column E: =IF(ISERROR(VLOOKUP(A2,A3:D$7,4,FALSE)),"",VLOOKUP (A2,A3:D$7,4,FALSE)) CA |
#3
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Thanks for your fast reply, and I have tried your solution,but I'm no
sure what to do with it. I'm not much good at it. But I will give more clearer view of what I'm trying to do. I have sheet nr.1 with column A contain the date of the drawing. Colum B,C,D,E,F,G contain the numbers from the drawings. The numbers rang from 1 to 45. On sheet nr.2 I have a column A containing number 1 dow to 45, column B contains how many weeks ago that number fell. I di that with a COUNTIF statement. (COUNTIF(sheet1!B:G;A1) This nicely add up how long ago the drawings was. But say when this week the numbe draws, the number in column B should go to zero. I don't know to tackl this problem. As I stated earlier the way I tried it is not a way tha Excel allows -- Message posted from http://www.ExcelForum.com |
#4
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]() I think I have a fix for you: In my workbook I set the following: weekly number contains the weekly data (sorted with latest on top in row 5) with the numbers in columns b:f (I allowed for columns g and h too) analysis contains the equations for analyzing the data with cell c3 specifying how many weeks back to look for an occurance, and cell a1 a count of the total number of weeks, and the # you are searching for listed in column b The # of occurrances is" =COUNTIF('weekly numbers'!$B$5:OFFSET('weekly numbers'! $B$4,analysis!$A$1,COUNTA('weekly numbers'! $B$3:$H$3),1,1),analysis!$B6) The following finds the week of the last occurrance - do this column by column so if you have 5 weekly numbers you need this in 5 columns searching the columns of data one at a time. IF(ISNA(MATCH($B6,'weekly numbers'!B$5:OFFSET('weekly numbers'!B$4,analysis!$A$1+1,0,1,1),0)),"",MATCH ($B6,'weekly numbers'!B$5:OFFSET('weekly numbers'! B$4,analysis!$A$1+11,0,1,1),0)) Then use this to determine the latest occurance of the five columns (a # could be in column 1 one week and column 2 another) =IF(MIN(E6:I6)=0,"",MIN(E6:I6)) where columns e:i find the latest occurance for each column I guess I could just email you the worksheet. John -----Original Message----- Thanks for your fast reply, and I have tried your solution,but I'm not sure what to do with it. I'm not much good at it. But I will give a more clearer view of what I'm trying to do. I have sheet nr.1 with column A contain the date of the drawing. Column B,C,D,E,F,G contain the numbers from the drawings. The numbers range from 1 to 45. On sheet nr.2 I have a column A containing number 1 down to 45, column B contains how many weeks ago that number fell. I did that with a COUNTIF statement. (COUNTIF(sheet1!B:G;A1) This nicely adds up how long ago the drawings was. But say when this week the number draws, the number in column B should go to zero. I don't know to tackle this problem. As I stated earlier the way I tried it is not a way that Excel allows. --- Message posted from http://www.ExcelForum.com/ . |
#5
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
sorry - i missed one thing
this limits you to the right number of weeks to search (use cell c3 to limit you to say 5 last 5 weeks - in my sheet cell a1 was the total number of weeks of data) =COUNTIF('weekly numbers'!$B$5:OFFSET('weekly numbers'! $B$4,analysis!$C$3,COUNTA('weekly numbers'! $B$3:$H$3),1,1),$B5) John -----Original Message----- Thanks for your fast reply, and I have tried your solution,but I'm not sure what to do with it. I'm not much good at it. But I will give a more clearer view of what I'm trying to do. I have sheet nr.1 with column A contain the date of the drawing. Column B,C,D,E,F,G contain the numbers from the drawings. The numbers range from 1 to 45. On sheet nr.2 I have a column A containing number 1 down to 45, column B contains how many weeks ago that number fell. I did that with a COUNTIF statement. (COUNTIF(sheet1!B:G;A1) This nicely adds up how long ago the drawings was. But say when this week the number draws, the number in column B should go to zero. I don't know to tackle this problem. As I stated earlier the way I tried it is not a way that Excel allows. --- Message posted from http://www.ExcelForum.com/ . |
#6
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
I've tried the solutions mentioned, altough some parts seem to work, I
still doesn't do what I want it to do. I attached a zip file with sample of what I'm trying to do. Maybe it makes it all a bit clearer Attachment filename: testlotto.zip Download attachment: http://www.excelforum.com/attachment.php?postid=53126 -- Message posted from http://www.ExcelForum.com |
#7
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
I looked at your workbook. I would
1. sort by last at the top with one intervening row that is hidden, inserting each time at row 3 2. use a for each macro to find each number from the other page such as this example. Sub findem() for each c in numberrange c.offset(,1)=application.CountIf(Range("mt"), c) c.offset(,2) = Cells.Find(c, after:=Range("a2"), _ lookat:=xlWhole, searchorder:=xlByRows).Row - 2 next End Sub -- Don Guillett SalesAid Software "knoertje " wrote in message ... On one sheet I keep track of the lottery numbers every week. On another sheet I try to keep the statistics of these numbers, like how many times and how many drawings ago a number ........ The how many times was no problem, with a COUNTIF....but the how many drawings ago, doesn't work. I tried an IF (sheet1!A1:A6="number",sheet2!A1+1, sheet2!=1. But then I get a circular reference statement. How do I proceed????? --- Message posted from http://www.ExcelForum.com/ |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Excel Macro for Beginners | Excel Worksheet Functions | |||
Manual for beginners -- Charts with Excel | Charts and Charting in Excel | |||
Excel Macros for Beginners | Excel Discussion (Misc queries) | |||
Saving an Excel Spreadsheet with a particular name - Beginners | Excel Programming | |||
Saving an Excel Spreadsheet with a particular name - Beginners | Excel Programming |