# IF function and match to return value

1. ## IF function and match to return value

Hi guys,

I`m trying to automate a process/quicken it for some predictions I capture from friends for a football competition.

Using my table attached, can someone help me with writing an IF formula in cell F2 to say:
IF C2 matches B2, return the value 10, if C2 does not match B2, return the value 0

In G2 if the first number of E2 matches the first number of D2, return 5, if the first number of E2 does not match the first number of D2, return 0

In H2 if the second number of E2 matches the second number D2, return 5, if the second number of E2 does not match the second number D2, return 0

I`d really appreciate the help guys.  Register To Reply

2. ## Re: IF function and match to return value

Use the following formulae in the cells stated:

F2: =IF(B2=C2,10,0)

G2: =IF(LEFT(D2,FIND("-",D2)-1)=LEFT(E2,FIND("-",E2)-1),5,0)

H2: =IF(MID(D2,FIND("-",D2)+1,10)=MID(E2,FIND("-",E2)+1,10),5,0)

then copy down as required.

Hope this helps.

Pete  Register To Reply

3. ## Re: IF function and match to return value

On second thoughts, these would be more robust:

F2: =IF(OR(B2="",C2=""),"",IF(B2=C2,10,0))

G2: =IFERROR(IF(LEFT(D2,FIND("-",D2)-1)=LEFT(E2,FIND("-",E2)-1),5,0),"")

H2: =IFERROR(IF(MID(D2,FIND("-",D2)+1,10)=MID(E2,FIND("-",E2)+1,10),5,0),"")

and then you can copy them down as far as you like below the data that you have entered, in readiness for new data - they will return blanks until you enter appropriate data.

Hope this helps.

Pete  Register To Reply

4. ## Re: IF function and match to return value

This seems perfect! thanks so much Pete!

Rep added!   Register To Reply

5. ## Re: IF function and match to return value

Glad to be of help - cheers!

Pete  Register To Reply

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