+ Reply to Thread
Results 1 to 6 of 6

Excluding blank cells from a range of data

  1. #1
    Registered User
    Join Date
    10-10-2012
    Location
    Warks
    MS-Off Ver
    Excel 2013
    Posts
    91

    Excluding blank cells from a range of data

    Hi, I have a specific problem that I'm hoping someone can guide me in the right direction with. I'm looking to analyse some football scores to determine if the home side scored in both the first and second halves. The arrangement of data looks like this: Cell A2 has the home team in it, cells C2:J2 has blank cells so I can copy and paste goal times into them.

    So for example if Liverpool won 3-0 with goals in the 16th,32nd,55th minutes, the sheet would look like: Cell A2 Liverpool, C2:16, D2:32, E2:55, cells F2 to J2 would be empty. If a goal was scored in both the first and second halves (as per the example) then I want to place a 1 in the target cell, for any other outcome I want to place a 0. Ultimately I only want a 1 to appear if a goal was scored by the home team in both halves.

    I'm not great with excel and the only formula I have come up with is =IF(AND(C2:J2<=45,C2:J2>45),"1","0") but it occurred to me that blank cells are being classed as 0 and screwing up the first part of the calculation (although the actual calculation may be miles off anyway).

    If someone knows how to not include blank cells in the calculation then that would be great. Thanks in advance.

  2. #2
    Forum Guru benishiryo's Avatar
    Join Date
    03-25-2011
    Location
    Singapore
    MS-Off Ver
    Excel 2013
    Posts
    5,147

    Re: Excluding blank cells from a range of data

    hi Consty1, welcome to the forum. try:
    =IF(AND(COUNTIF(C2:J2,"<=45")>0,COUNTIF(C2:J2,">45")>0),1,0)

    Thanks, if you have clicked on the * and added our rep.

    If you're satisfied with the answer, click Thread Tools above your first post, select "Mark your thread as Solved".

    "Contentment is not the fulfillment of what you want, but the realization of what you already have."


    Tips & Tutorials I Compiled | How to Get Quick & Good Answers

  3. #3
    Registered User
    Join Date
    10-10-2012
    Location
    Warks
    MS-Off Ver
    Excel 2013
    Posts
    91

    Re: Excluding blank cells from a range of data

    Thank you, that works great.

  4. #4
    Registered User
    Join Date
    10-10-2012
    Location
    Warks
    MS-Off Ver
    Excel 2013
    Posts
    91

    Re: Excluding blank cells from a range of data

    Following on from this there's another situation I've been thinking about where the blanks are disrupting the outcome.

    I'm looking to work out a formula for if the home team scored first, taking the previous example let's say Liverpool won 3-1 against Spurs. Liverpool's goals were scored in the 16th, 32nd, 55th minutes. Spurs scored in the 22nd minute.

    So C2:16, D2:32, E2:55, F2:J2 are empty. M2:T2 are cells for the away team goals to be entered so M2:22 and the other cells are empty.

    If the home team scored first (as in the example) then I'd like the target cell to be 1, if the away team scored first then a 0 would be placed in the target cell. If the game finished 0-0 then again I'd like a 0 placed. Also if the home team won by 1-0 then that would be classed as the home team scoring the first goal and a 1 would be placed.

    Again if anyone has any ideas for this then that would be awesome.

  5. #5
    Forum Guru benishiryo's Avatar
    Join Date
    03-25-2011
    Location
    Singapore
    MS-Off Ver
    Excel 2013
    Posts
    5,147

    Re: Excluding blank cells from a range of data

    you're welcome. this is a different scenario right? try:
    =IF(MIN(C2:J2)<MIN(M2:T2),1,0)

    but if it's to be combined with your 1st question,
    =IF(AND(COUNTIF(C2:J2,"<=45")>0,COUNTIF(C2:J2,">45")>0,MIN(C2:J2)<MIN(M2:T2)),1,0)

  6. #6
    Registered User
    Join Date
    10-10-2012
    Location
    Warks
    MS-Off Ver
    Excel 2013
    Posts
    91

    Re: Excluding blank cells from a range of data

    Thanks for putting the time in to have a look at this. I came across an answer in another thread that has worked (and yes it's a different scenario).

    The formula is =IF(COUNT(C2:J2)=0,0,IF(COUNT(M2:T2)=0,1,IF(MIN(C2:J2)<MIN(M2:T2),1,0)))

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1