# Merging of formula

##### Member
Hi,
I have two formula which I want to merge-

1.=IF(C12="","",IF(C12=E12,"same",""))
2.=IF(D12="","",IF(D12=F12,"same",""))

The first formula says that if C12 & E12 are same i.e it must be numeric value then result will display "same",else space.Pls note that C12 & E12 might contains space i.e blank in both C12 & E12 in that case also it will display"same" becoz both are same,this blank should be ignored.Similarly No.2 formula also but different references.

#### Hui

##### Excel Ninja
Staff member
=IF(or(D12=F12, C12=E12),"same","")

##### Member
It didn't worked as expected.

#### Hui

##### Excel Ninja
Staff member
Can you explain why it didn’t work with examples of shag values each cell had and the answer it should be?

#### Peter Bartholomew

##### Well-Known Member
It is not really made clear what is meant by 'merging' the two conditions.
Should both conditions hold or will either do? Are text strings valid or must the cells contain numbers? If numbers, are they integers, in which case equality tests are sufficient, or non-integers. The latter would require equality to within some tolerance to allow for rounding error.

If the required condition is AND rather than OR
= IF( AND( ISNUMBER(C12), ISNUMBER(E12), (C12=E12), (D12=F12) ), "same", "" )
or a rather more algebraic form
= IF( (C12<>"") * (E12<>"") * (C12=E12) * (D12=F12), "same", "" )

##### Member
Sorry for delay reply.I have given example in simpler form.Pls find enclosed in attachment file.This will clear.Refer my last column results that I am expecting.

#### Attachments

• 8.4 KB Views: 4
Last edited:

#### vletm

##### Excel Ninja
This gives same as Your expected results...

#### Attachments

• 9.1 KB Views: 6

#### Hui

##### Excel Ninja
Staff member
My formula above works fine
It is the cell addresses of your data that are different to what you asked of us above ?

F2: Should be when adjusted: =IF(OR(C2=E2, B2=D2),"same","")

#### bosco_yip

##### Excel Ninja
Maybe,

F2, copied down :

=IF(N(B2)*N(D2)*(B2=D2)+N(C2)*N(E2)*(C2=E2),"same","")

Regards
Bosco