+ Reply to Thread
Results 1 to 6 of 6

How can i add a 'but-if' then.....variable to a formula?

  1. #1
    Registered User
    Join Date
    02-23-2015
    Location
    Perth Autralia
    MS-Off Ver
    2010
    Posts
    41

    How can i add a 'but-if' then.....variable to a formula?

    Can someone help me with extending/amending the following formula please? It does exactly what it states but I need to add a variable and my efforts thus far result in error after error; might have something to do with my level of experience which isn’t all that flash!!!

    =IF(AND(ISBLANK('Transactions Register '!AC10),ISBLANK('Transactions Register '!AU10),ISBLANK('Transactions Register '!BK10),ISBLANK('Transactions Register '!CG10)),"AVAILABLE ","SOLD")

    Formula is in H10 on sheet ‘Inventory Listing’ and needs to tell me if the item, in the corresponding row on sheet ‘Transactions Register’, is AVAILABLE or SOLD. All reference cells are dates; however, AC10 = Cash Sales Date
    BK10 = eSale Date
    AU10 = Cash Refund Date
    CG10 = eSale Refund Date

    So what I want to achieve is:
    If all cells are empty return AVAILABLE
    If cells AC10 or BK10 are not empty return SOLD
    If cells AU10 or CG10 are not empty return AVAILABLE
    This needs to be the case even if AC10 or BK10 are populated, as the item will have been returned and refunded and is therefore available but I still need to retain the sales date for record keeping etc.

    Appreciate your help

  2. #2
    Administrator FDibbins's Avatar
    Join Date
    12-29-2011
    Location
    Duncansville, PA USA
    MS-Off Ver
    Excel 7/10/13/16/365 (PC ver 2310)
    Posts
    52,938

    Re: How can i add a 'but-if' then.....variable to a formula?

    Assuming those cells are data entry cells, you could already simplify that formula top this...
    =IF(counta('Transactions Register '!AC10,'Transactions Register '!AU10,'Transactions Register '!BK10,'Transactions Register '!CG10)=0,,"AVAILABLE ","SOLD")

    so that would then become...
    =IF(or(AC10<>"",BK10<>""),"SOLD",if(or(AU10<>"",CG10<>""),"AVAILABLE",if(counta('Transactions Register '!AC10,'Transactions Register '!AU10,'Transactions Register '!BK10,'Transactions Register '!CG10)=0,"AVAILABLE ","SOLD")
    or maybe try this...
    =IF(or(AC10<>"",BK10<>""),"SOLD",if(or(AU10<>"",CG10<>""),counta('Transactions Register '!AC10,'Transactions Register '!AU10,'Transactions Register '!BK10,'Transactions Register '!CG10)=0),"AVAILABLE ","SOLD")
    1. Use code tags for VBA. [code] Your Code [/code] (or use the # button)
    2. If your question is resolved, mark it SOLVED using the thread tools
    3. Click on the star if you think someone helped you

    Regards
    Ford

  3. #3
    Forum Expert
    Join Date
    11-26-2013
    Location
    Colac, Victoria, Australia
    MS-Off Ver
    Excel 2016
    Posts
    1,309

    Re: How can i add a 'but-if' then.....variable to a formula?

    It seems to me that the only condition where you would have SOLD is when you have a date in AC10 or BL10.

    Therefore, I would use =IF(COUNT('Transactions Register'!AC10,'Transactions Register'!BK10)>0,"SOLD","AVAILABLE")

    This is a bit simpler than IF(AND...)

    I hope this helps, please let me know!

    Regards,

    David


    - Please click on the *Add Reputation button at the bottom of helpful responses.

    Please mark your thread as SOLVED:
    - Click Thread Tools above your first post, select "Mark your thread as Solved".


  4. #4
    Registered User
    Join Date
    02-23-2015
    Location
    Perth Autralia
    MS-Off Ver
    2010
    Posts
    41

    Re: How can i add a 'but-if' then.....variable to a formula?

    Hi David thanks for your prompt help; I like your logic clearly I have none lol!!! Your formula didn't initially work but after a bit of research it worked by starting =IF(COUNTA( instead of =IF(COUNT(

    Thanks again

    Cheers
    Brett

  5. #5
    Forum Expert
    Join Date
    11-26-2013
    Location
    Colac, Victoria, Australia
    MS-Off Ver
    Excel 2016
    Posts
    1,309

    Re: How can i add a 'but-if' then.....variable to a formula?

    Thanks Brett,

    I guess I used COUNT instead of COUNTA because I thought you were working with dates. (I note that Ford offered a similar solution - he used COUNTA)

    Regards,

    David

  6. #6
    Forum Expert
    Join Date
    11-26-2013
    Location
    Colac, Victoria, Australia
    MS-Off Ver
    Excel 2016
    Posts
    1,309

    Re: How can i add a 'but-if' then.....variable to a formula?

    Thanks Brett,

    I guess I used COUNT instead of COUNTA because I thought you were working with dates. (I note that Ford offered a similar solution - he used COUNTA)

    Regards,

    David


    - Please click on the *Add Reputation button at the bottom of helpful responses.

    Please mark your thread as SOLVED:
    - Click Thread Tools above your first post, select "Mark your thread as Solved".


+ Reply to Thread

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. Changing column variable on a copied formula instead of row variable
    By dsw283 in forum Excel Formulas & Functions
    Replies: 1
    Last Post: 12-06-2014, 04:13 PM
  2. Variable in formula
    By Myyst in forum Excel Formulas & Functions
    Replies: 1
    Last Post: 09-23-2014, 01:53 PM
  3. Replies: 4
    Last Post: 07-12-2013, 12:14 PM
  4. 3 variable formula
    By zballz in forum Excel General
    Replies: 1
    Last Post: 01-18-2011, 01:58 PM
  5. formula max variable
    By ilkamalo in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 03-16-2009, 08:50 AM
  6. Replies: 1
    Last Post: 10-31-2006, 08:34 AM
  7. [SOLVED] Using a variable in a formula
    By Patrick Simonds in forum Excel Programming / VBA / Macros
    Replies: 7
    Last Post: 10-17-2005, 05:05 AM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1