+ Reply to Thread
Results 1 to 5 of 5

Conditional formatting based on based on user input to sum particular cells

  1. #1
    Registered User
    Join Date
    02-25-2013
    Location
    USA
    MS-Off Ver
    Excel 2010
    Posts
    2

    Conditional formatting based on based on user input to sum particular cells

    I'm trying to figure out a conditional statement that will add cells based on text inputs from another sheet. For example, if cell C1 contains the word "lighting", and cell D1 has the number 5 in it, I want the contents of D1 to be input into some arbitrary cell, lets say A1. However, if cell C1 contains the word "power" I want the contents of D1 to be placed in cell another cell lets say A2. I read somewhere that you cannot sum cells based on conditional statements, so I'm trying this around the world approach. If anyone has an easier way of doing this, please feel free to give me your advice.

  2. #2
    Forum Expert dredwolf's Avatar
    Join Date
    10-27-2012
    Location
    Clearwater,Canada
    MS-Off Ver
    Excel 2007
    Posts
    2,649

    Re: Conditional formatting based on based on user input to sum particular cells

    Not sure exactly what you are asking here...summing, or deciding whether the value of d1 winds up in cell a1 or a2 depending on c1?
    Also..CF only affects visual output of a cell, doesn't affect the contents of the cell, so it is probably not what you need

    In a1 =IF(C1="lighting",D1,"")
    In a2 =IF(C1="power",D1,"")

    handles the latter, to sum a range (say D1:D100) based on contents of C1:C100

    in a1 : =SUMIF($C$1:$C$100,"lighting",$D$1:$D$100)
    in a2 : =SUMIF($C$1:$C$100,"power",$D$1:$D$100)

    may work for the first..would depend on your data set-up

    Hope this helps
    A picture may be worth a thousand words, BUT, a sample Workbook is worth a thousand screenshots!
    -Add a File - click advanced (next to quick post), scroll to manage attachments, click, select add files, click select files, select file, click upload, when file shows up at bottom left, click done (bottom right), click submit
    -To mark thread Solved- go top of thread,click Thread Tools,click Mark as Solved
    If you received helpful response, please remember to hit the * of that post

  3. #3
    Valued Forum Contributor xlbiznes's Avatar
    Join Date
    02-22-2013
    Location
    Bahrain
    MS-Off Ver
    Excel 2007
    Posts
    1,223

    Re: Conditional formatting based on based on user input to sum particular cells

    Hi,

    You can sum numbers based on conditions.
    use sumif() for a single condition or sumifs() for multiple conditions. This will solve your problem.
    Happy Computing ,

    Xlbiznes.

    To show your appreciation please click *

  4. #4
    Registered User
    Join Date
    02-25-2013
    Location
    USA
    MS-Off Ver
    Excel 2010
    Posts
    2

    Re: Conditional formatting based on based on user input to sum particular cells

    Quote Originally Posted by dredwolf View Post
    Not sure exactly what you are asking here...summing, or deciding whether the value of d1 winds up in cell a1 or a2 depending on c1?
    Also..CF only affects visual output of a cell, doesn't affect the contents of the cell, so it is probably not what you need

    In a1 =IF(C1="lighting",D1,"")
    In a2 =IF(C1="power",D1,"")

    handles the latter, to sum a range (say D1:D100) based on contents of C1:C100

    in a1 : =SUMIF($C$1:$C$100,"lighting",$D$1:$D$100)
    in a2 : =SUMIF($C$1:$C$100,"power",$D$1:$D$100)

    may work for the first..would depend on your data set-up

    Hope this helps

    Thanks, that helps a lot. One of my other problems was I was trying to assign a cell, instead of using just the cell identifier in the formula. Got hung up on programming language instead of excel language. Thanks, i got it figured out now.

  5. #5
    Forum Expert dredwolf's Avatar
    Join Date
    10-27-2012
    Location
    Clearwater,Canada
    MS-Off Ver
    Excel 2007
    Posts
    2,649

    Re: Conditional formatting based on based on user input to sum particular cells

    Cool !
    Glad I could help

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

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