Test in an Excel spreadsheet

Solved
Maya64200 Posted messages 2 Registration date   Status Member Last intervention   -  
eriiic Posted messages 24581 Registration date   Status Contributor Last intervention   -
Hello,

I have a table with two columns and three rows

Apartment = 1
Garage = 0.5
Parking = 0.1

I want the value to be 1 if the cell content is "Apartment"
I want the value to be 0.5 if the cell content is "Garage"
I want the value to be 0.1 if the cell content is "Parking"

How can I program this in my Excel sheet?

5 answers

  1. Thorak83 Posted messages 1140 Status Member 156
     
    Hello,

    Assuming that cell A1 contains the text and A2 the value, enter this formula in A2

    =IF(A1="Apartment",1,IF(A1="Garage",0.5,0.1))

    This means If A1 is equal to Apartment then 1 otherwise If A1 is equal to Garage then 0.5 otherwise 0.1.

    Best regards
    1
    1. Maya64200
       
      Yes, I have 16 possible cases that are on a separate sheet from the first one. I need to run a test on 16 values that are in a table, which should return the value corresponding to the second column of the same row.
      Thank you for looking into this matter.
      0
    2. eriiic Posted messages 24581 Registration date   Status Contributor Last intervention   7 281
       
      Maya, I think you missed the post below.
      0
  2. Maya64200 Posted messages 2 Registration date   Status Member Last intervention  
     
    Dear Chris
    This is my first request and my first participation in this forum. I'm discovering and I'm more focused on the functioning of the site than on good manners! You are absolutely right to remind me of some basic principles. So, I sincerely apologize and ask the internet users to forgive me.
    Thank you for your response. However, I simplified my problem to be understood. In fact, the list has 16 rows with different values. Can't we run a test on a range of cells?
    With my thanks for your responses!
    0
  3. Thorak83 Posted messages 1140 Status Member 156
     
    I'm having a bit of trouble understanding.
    Are you saying that there are 16 possible cases?

    Simplifying is fine, but it needs to be accurate.
    0
  4. eriiic Posted messages 24581 Registration date   Status Contributor Last intervention   7 281
     
    Hello,

    with your name/value table in: $G$2:$H$17:
    =VLOOKUP(A2,$G$2:$H$17,2,FALSE)

    eric

    --
    You will never respond to an unsolicited DM...
    Well, that's done.
    0