Formula Audit

excel_sp

New Member
Joined
Feb 25, 2018
Messages
9
Hi all,

In my worksheet there are two cells D8 and E8 where I have to input data and the outcome of the formula will be visible on M8 cell.

Below is the tabular representation of data input in cells, and their expected output


Value in D8Value in E8Outcome
EE10
NAE10
>=85%E10
<85%E5
E5
ENA10
NANA10
>=85%NA10
<85%NA0
NA0
E5
NA0
>=85%5
<85%0
0
E>=85%10
NA>=85%10
>=85%>=85%10
<85%>=85%5
>=85%5

<tbody>
</tbody>
E<85%5
NA<85%0
>=85%<85%5
<85%<85%0
<85%0

<tbody>
</tbody>

The formula that I am using is as under:
Code:
=IF(E8="E",IF(OR(D8="E",D8="NA",D8>85%),10,5),IF(E8="NA",IF(OR(D8="E",D8="NA",D8>=85%),10,0),IF(E8="",IF(OR(D8="E",D8>=85%),5,0),IF(E8>=85%,IF(OR(D8="E",D8="NA",D8>=85%),10,5),IF(E8<85%,IF(OR(D8="E",D8>=85%),5,0))))))
With above code, most of the time, the outcome is expected, except in below two situations
Value in D8Value in E8Real OutcomeExpected Outcome
NA60%50
NA50

<tbody>
</tbody>


I am not able to find the error in the formula. Can you please guide me?

Thanks in advance.
 

Special-K99

Well-known Member
Joined
Nov 7, 2006
Messages
8,327
The thing to do in a case like this is isolate the problem.
As you have multiple results for 5 I changed each 5 to a different value 5.1, 5.2, 5.3, 5.4
Result was 5.4
So it's the last condition that's causing this

IF(E8<85%,
IF(OR(D8="E",D8>=85%),5,0))))))

Removing the D8>=85% produces 0

I suspect when D8 is NA it is regarded as >85% and therefore returns 5.
Which means your other % conditions may cause problems like this too.

Confirmed: When D8 is NA, =D8>85% returns TRUE
 
Last edited:

Special-K99

Well-known Member
Joined
Nov 7, 2006
Messages
8,327
This looks better

=IF(E8="E",IF(OR(D8="E",D8="NA",AND(ISNUMBER(D8),D8> =85%)),10,5.1),IF(E8="NA",IF(OR(D8="E",D8="NA",AND(ISNUMBER(D8),D8> =85%)),10,0),IF(E8="",
IF(OR(D8="E",AND(ISNUMBER(D8),D8> =85%)),5.2,0),IF(AND(ISNUMBER(E8),E8> =85%),IF(OR(D8="E",D8="NA",AND(ISNUMBER(D8),D8> =85%)),10,5.3),
IF(AND(ISNUMBER(E8),E8< 85%),IF(OR(D8="E",AND(ISNUMBER(D8),D8> =85%)),5.4,0))))))

When checking for 85% use AND(ISNUMBER(cell),cell condition)
 
Last edited:

Special-K99

Well-known Member
Joined
Nov 7, 2006
Messages
8,327
Here's another way of doing it, somewhat convoluted.
In a blank cell, let's say G8

in G8
=(D8="E")*1+(D8="NA")*2+(D8="")*4+AND(ISNUMBER(D8),D8> =85%)*8+AND(ISNUMBER(D8),D8< 85%)*16+(E8="E")*32+(E8="NA")*64+(E8="")*128+AND(ISNUMBER(E8),E8> =85%)*256+AND(ISNUMBER(E8),E8< 85%)*512

Each condition when TRUE results in a power of 2.
By summing the results you can tell which of the conditions are TRUE.
So if D8 was E and E8 was E the result would be 1+32 = 33
So we just need to check for the totals of the conditions we are interested in that are TRUE.

in H8
IF(OR(G8=33,G8=34,G8=40,G8=65,G8=66,G8=72,G8=257,G8=258,G8=264),10,IF(OR(G8=48,G8=36,G8=129,G8=136,G8=528,G8=260,G8=513,G8=520),5,0))
 

Forum statistics

Threads
1,082,300
Messages
5,364,381
Members
400,796
Latest member
vrcdesktop

Some videos you may like

This Week's Hot Topics

  • populate from drop list with multiple tables
    Hi All, i have a drop list that displays data, what i want is when i select one of those from the list to populate text from different tables on...
  • Find list of words from sheet2 in sheet1 before a comma and extract text vba
    Hi Friends, Trying to find the solution on my task. But did not find suitable one to the need. Here is my query and sample file with details...
  • Dynamic Formula entry - VBA code sought
    Hello, really hope one of you experts can help with this - i've spent hours on this and getting no-where. .I have a set of data (more rows than...
  • Listbox Header
    Have a named range called "AccidentsHeader" Within my code I have: [CODE]Private Sub CommandButton1_Click() ListBox1.RowSource =...
  • Complex Heat Map using conditional formatting
    Good day excel world. I have a concern. Below link have a list of countries that carries each country unique data. [URL...
  • Conditional formatting
    Hi good morning, hope you can help me please, I have cells P4:P54 and if this cell is equal to 1 then i want row O to say "Fully Utilised" and to...
Top