If one cell contains this text and another contains that text then do this

spoogehead

New Member
Joined
Sep 15, 2002
Messages
31
Hi all

Wrestling with the count IF function but I'm stuck in trying to get to check two cells at the same time and then put a value in another cell. Is Lookup the right function to use here?

So basically:
A1 contains the text H (or h)
A2 contains the day of the week (Mon-Sat)

So I am looking for a check that:
If A1 contains H (or h) AND A2 contains Sat or Sun then the value returned is a numerical 12
If A1 contains H (or h) AND A2 contains Mon through Friday then the value returned is a numerical 8

If neither of the above conditions are met, then the cell is left blank

Thanks in advance!
 

Excel Facts

When did Power Query debut in Excel?
Although it was an add-in in Excel 2010 & Excel 2013, Power Query became a part of Excel in 2016, in Data, Get & Transform Data.
Is A2 an excel date or a text value like "Mon"

If the latter
=IF(a1="h", IF(OR(A2="Sat",A2="Sun"), 12, 8), "h not in A1")
 
Upvote 0
How about
=IF(A1="h",IF(OR(A2={"Sat","Sun"}),12,IF(OR(A2={"Mon","Tue","Wed","thu","fri"}),8,"")),"")
 
Upvote 0
Glad we could help & thanks for the feedback.
 
Upvote 0

Forum statistics

Threads
1,214,932
Messages
6,122,331
Members
449,077
Latest member
jmsotelo

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