I have a spreadsheet that I use for keeping cricket batting averages.
Entries will be something like 24, 0, 47, 98*, dnb, 12, 124, 26, each entered in separate cells. The * means that the player was 'not out', & the dnb stands for 'did not bat', which means he played in the game but didn't bat.
I count the number of matches played in cell I2 with
COUNTA(A2:H2)
I count the number of times the player was 'not out' in K2 with
{=SUM(IF(RIGHT(A2:H2,1)="*",1,""))}
I count the number of Innings with
COUNT(A2:H2)+K2 ie the number of numerical values in the range plus the number of not outs which gives the total times he batted
The total number of runs is calculated with
{=SUM((IF(RIGHT(A2:H2,1)="*",VALUE(SUBSTITUTE(A2:H2,"*","")),A2:H2)))} as it needs to 'remove' the asterix from the 'not outs' before adding.
Highest Score is calculated with
{=MAX((IF(RIGHT(A2:H2,1)="*",VALUE(SUBSTITUTE(A2:H2,"*","")),A2:H2)))}
All of the above work OK.
I'm trying to count the number of times a player has scored 50 or more, but it's the conditional formula to get rid of the asterisks that's driving me mad. I'm trying to use
{=COUNTIF((IF(RIGHT(A2:H2,1)="*",VALUE(SUBSTITUTE(A2:H2,"*","")),A2:H2)),">49")} but this returns #value
It's pretty much the same as the other conditionals I've used but I can't work out why SUM works with the conditional but COUNTIF doesn't.
I know I could do this in several separate steps in separate cells, but I'd like to do it in one cell if possible. I can email an example sheet to anyone who might be able to help with the answer. I've posted a copy of the example sheet to: http://rapidshare.com/files/170428005/MrExcelExamplesheet.xls.html
Thanks for your help.
Entries will be something like 24, 0, 47, 98*, dnb, 12, 124, 26, each entered in separate cells. The * means that the player was 'not out', & the dnb stands for 'did not bat', which means he played in the game but didn't bat.
I count the number of matches played in cell I2 with
COUNTA(A2:H2)
I count the number of times the player was 'not out' in K2 with
{=SUM(IF(RIGHT(A2:H2,1)="*",1,""))}
I count the number of Innings with
COUNT(A2:H2)+K2 ie the number of numerical values in the range plus the number of not outs which gives the total times he batted
The total number of runs is calculated with
{=SUM((IF(RIGHT(A2:H2,1)="*",VALUE(SUBSTITUTE(A2:H2,"*","")),A2:H2)))} as it needs to 'remove' the asterix from the 'not outs' before adding.
Highest Score is calculated with
{=MAX((IF(RIGHT(A2:H2,1)="*",VALUE(SUBSTITUTE(A2:H2,"*","")),A2:H2)))}
All of the above work OK.
I'm trying to count the number of times a player has scored 50 or more, but it's the conditional formula to get rid of the asterisks that's driving me mad. I'm trying to use
{=COUNTIF((IF(RIGHT(A2:H2,1)="*",VALUE(SUBSTITUTE(A2:H2,"*","")),A2:H2)),">49")} but this returns #value
It's pretty much the same as the other conditionals I've used but I can't work out why SUM works with the conditional but COUNTIF doesn't.
I know I could do this in several separate steps in separate cells, but I'd like to do it in one cell if possible. I can email an example sheet to anyone who might be able to help with the answer. I've posted a copy of the example sheet to: http://rapidshare.com/files/170428005/MrExcelExamplesheet.xls.html
Thanks for your help.