southcali12

New Member
Joined
Sep 22, 2015
Messages
28
Hello,

I am trying to create an IF statement for column H to determine an available time for each client.

In column H, I am only looking at the preferred columns (B,D,F). If there are more than three duplicate times per column, I want column H to return with "Look at Preferred Options" so that way I know I have to look at their preferred availability. However, if there are not three or more duplicate times per column, then I want it to return with the preferred value for each client.

The formula I have right now in column H is: =IF(COUNTIF(B:B,B3)=3,"Look at Preferred Options",IF(COUNTIF(D:D,D3)=3,"Look at Preferred Options",IF(COUNTIF(F:F,F3)=3,"Look at Preferred Options",(B3,D3,F3))))

However, I understand that what I have underlined and bolded above for when the statement is false is not correct, but am lost at how to fix it so that it will look through the preferred times and return the preferred value. I hope that made sense!

Reference of what my sample looks like:
Client
Preferred
Alternate
Preferred
Alternate
Preferred
Alternate
Selected Time

10/26/2015
10/26/2015
10/27/2015
10/27/2015
10/28/2015
10/28/2015

Tom
4:00 - 5:00 PM


3:00 - 4:00 PM


Look at Preferred Options
Sally
4:00 - 5:00 PM




2:00 - 3:00 PM
Look at Preferred Options
Maggie

12:00 - 1:00 PM
6:00 - 7:00 PM



#VALUE!
Joe



10:00 - 11:00 AM
8:00 AM - 9:00 AM

#VALUE!
Lily
4:00 - 5:00 PM
1:00 - 2:00 PM




Look at Preferred Options
Harry



1:00 - 2:00 PM
4:00 - 5:00 PM

#VALUE!

<tbody>
</tbody>
 
Last edited:

Excel Facts

Using Function Arguments with nested formulas
If writing INDEX in Func. Arguments, type MATCH(. Use the mouse to click inside MATCH in the formula bar. Dialog switches to MATCH.
Hi,

This should do, I added greater than along with equal to 3, cause your client list is most likely going to be longer...:

=IF(OR(COUNTIF(B:B,B3)>=3,COUNTIF(D:D,D3)>=3,COUNTIF(F:F,F3)>=3),"Look at Preferred Options",IF(B3<>"",B3,IF(D3<>"",D3,F3)))

Let me know if this works for you.
 
Upvote 0
Hi jtakw,

It works perfectly. Even better since you added the greater than 3. Thank you so much! :)

However, do you now how I could adjust the formula if my data is all pulled from VLOOKUPs? So all the data in the table is all pulled from VLOOKUPs, and all the cells that appear empty, technically, have formulas in them. And correct me if I'm wrong but the IF formula won't work then right?
 
Last edited:
Upvote 0
Hi,

I'm not sure if I understand exactly what you mean..but, if your data as shown in your original post comes from VLOOKUPs, the IF formula should still work.
 
Upvote 0
I think the blank cells are being recognized as having data in them because in the formula bar there is the VLOOKUP formula. So the IF function will return "Look at Preferred Options" even if there isn't 3 or more of the same times listed in each column.
It could be something else that I'm doing, but when I copy and paste values over, the IF function will return with "Look at Preferred Options" regardless of the amount of time slots. However, if I manually type in each data, then the IF function works perfectly. :D
 
Upvote 0
Hi,

=IF(OR(COUNTIF(B:B,B3)>=3,COUNTIF(D:D,D3)>=3,COUNTIF(F:F,F3)>=3),"Look at Preferred Options",IF(B3<>"",B3,IF(D3<>"",D3,F3)))

Let me know if this works for you.

No, because it's looking in column B for a match of B3 ONLY, so whatever else are in the other cells won't match; however, you may want to limit the array, instead of B:B to B2:Bwhatever_row, D:D to D:Dwhatever_row, etc....

An actual sample of your sheet would help...
 
Last edited:
Upvote 0
Hi,

I think I know what is causing your problem, your blank cells probably is not blank, but have a space in them (looks blank but it's not), so the formula will count the spaces in the column, thereby giving you the wrong (actually correct) result of "Look at Preferred Options".
Since the data table is a result of your VLOOKUP, the space is most likely from the original data set you're looking up.
Check the cell formulas in the original data set that looks blank for " ", and replace them with "". (" " is a space, whereas "" is blank), unless intentional; otherwise using " " in formulas instead of "" will cause all kinds of problems down the road.

As an example:
=IF(A1=B1,C1," ")
should be:
=IF(A1=B1,C1,"")
 
Upvote 0
In case your VLOOKUP formula is inside an IF formula, please check it for the same problem described above.
 
Upvote 0

Forum statistics

Threads
1,215,419
Messages
6,124,796
Members
449,189
Latest member
kristinh

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top